pub struct AnsiStyle {
pub fg_color: Option<AnsiColor>,
pub bg_color: Option<AnsiColor>,
pub bold: bool,
pub intense: bool,
pub underline: bool,
pub dimmed: bool,
pub italic: bool,
pub reset: bool,
pub strikethrough: bool,
}Expand description
The definition of the ANSI styles.
Fields§
§fg_color: Option<AnsiColor>The foreground color.
bg_color: Option<AnsiColor>The background color.
bold: boolGet whether this is bold or not.
intense: boolGet whether this is intense or not.
On Unix-like systems, this will output the ANSI escape sequence that will print a high-intensity version of the color specified.
On Windows systems, this will output the ANSI escape sequence that will print a brighter version of the color specified.
underline: boolGet whether this is underlined or not.
dimmed: boolGet whether this is dimmed or not.
Note that the dimmed setting has no effect in a Windows console.
italic: boolGet whether this is italic or not.
Note that the italic setting has no effect in a Windows console.
reset: boolGet whether reset is enabled or not.
reset is enabled by default. When disabled and using ANSI escape
sequences, a “reset” code will be emitted every time a ColorSpec’s
settings are applied.
Note that the reset setting has no effect in a Windows console.
strikethrough: boolGet whether this is strikethrough or not.
Note that the strikethrough setting has no effect in a Windows console.
Implementations§
Source§impl AnsiStyle
impl AnsiStyle
Sourcepub fn new(foreground: AnsiColor) -> AnsiStyle
pub fn new(foreground: AnsiColor) -> AnsiStyle
Create a new ColorSpec with the foreground color specified.
Sourcepub fn rgb(r: u8, g: u8, b: u8) -> AnsiStyle
pub fn rgb(r: u8, g: u8, b: u8) -> AnsiStyle
Create a new ColorSpec with the foreground color specified.
Sourcepub fn with_fg_color(self, color: AnsiColor) -> AnsiStyle
pub fn with_fg_color(self, color: AnsiColor) -> AnsiStyle
Create a new ColorSpec with the foreground color specified.
Sourcepub fn with_bg_color(self, color: AnsiColor) -> AnsiStyle
pub fn with_bg_color(self, color: AnsiColor) -> AnsiStyle
Create a new ColorSpec with the background color specified.
Sourcepub fn with_underline(self) -> AnsiStyle
pub fn with_underline(self) -> AnsiStyle
Create a new AnsiStyle with underline enabled.
Sourcepub fn with_italic(self) -> AnsiStyle
pub fn with_italic(self) -> AnsiStyle
Create a new AnsiStyle with dimmed enabled.