Import std.term.style
Style
struct
Public Struct Style Implements Hashable, Printable
How text looks: its Foreground color, the Background color behind it, and its Attributes. Its
zero is plain text, as the terminal shows it, and Style(TermColor.Red).Bold() is bold red.
Examples
Local warning = Style(TermColor.Yellow).Bold()
Expect(warning.Apply("careful", ColorLevel.NONE) == "careful")
Local shown = warning.Apply("careful", ColorLevel.TRUE_COLOR)
Expect(shown != "careful" && StripStyles(shown) == "careful")
Expect(VisibleWidth(shown) == 7)-
Its text's color.
-
The color behind its text.
-
Its attributes, like BOLD, which combine.
-
Whether it's plain text, as the terminal shows it.
-
A copy with
backgroundbehind the text. -
A copy with
attributestoo. -
A copy that's bold too.
-
A copy that's dim too.
-
A copy that's italic too.
-
A copy that's underlined too.
-
A copy that blinks too.
-
A copy with its colors swapped too.
-
A copy that's hidden too.
-
A copy that's struck through too.
-
This style over
under: its own colors, andunder's where it has the terminal's NORMAL ones, and both's attributes, as a list's selected line is drawn over its own style. -
The escape code that starts it, from plain text, as a terminal of
level's colors shows it, like "\e[0;1;31m", or "" wherelevelis NONE. A plain style is "\e[0m". -
textas this style shows it on a terminal oflevel's colors: between the codes that start it and the one that ends it, or alone wherelevelis NONE or the style is plain. -
Like "bold red on blue", or "plain".
Report an issue with this page or with FutureBlitz on GitHub.