View Source AnsiToHTML.Theme (AnsiToHTML v0.5.3)
AnsiToHTML.Theme
structs define how the ANSI should be converted to html tags.
You can pass a custom theme to both AnsiToHTML.generate_html/2
and AnsiToHTML.generate_phoenix_html/2
as the second argument.
Tags are matches against their ANSI code and converted to Phoenix.HTML.Tag.t
.
The expected pattern for a tag is a tuple of an atom representing the html tag, and a keyword list with it's html attributes.
examples
Examples
iex> %AnsiToHTML.Theme{name: "My Theme", container: {:pre, [class: "container"]}, "[4m": {:span, [class: "has-underline"]}}
%AnsiToHTML.Theme{"[1m": {:strong, []},
"[30m": {:span, [style: "color: black;"]},
"[31m": {:span, [style: "color: red;"]},
"[32m": {:span, [style: "color: green;"]},
"[33m": {:span, [style: "color: yellow;"]},
"[34m": {:span, [style: "color: blue;"]},
"[35m": {:span, [style: "color: magenta;"]},
"[36m": {:span, [style: "color: cyan;"]},
"[37m": {:span, [style: "color: white;"]}, "[3m": {:i, []},
"[40m": {:span, [style: "background-color: black;"]},
"[41m": {:span, [style: "background-color: red;"]},
"[42m": {:span, [style: "background-color: green;"]},
"[43m": {:span, [style: "background-color: yellow;"]},
"[44m": {:span, [style: "background-color: blue;"]},
"[45m": {:span, [style: "background-color: magenta;"]},
"[46m": {:span, [style: "background-color: cyan;"]},
"[47m": {:span, [style: "background-color: white;"]},
"[49m": {:span, [style: "background-color: black;"]},
"[4m": {:span, [class: "has-underline"]},
"[9m": {:span, [style: "text-decoration: line-through;"]},
container: {:pre, [class: "container"]}, name: "My Theme"}