Struct color_ansi::AnsiStyle
source · 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: bool
Get whether this is bold or not.
intense: bool
Get 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: bool
Get whether this is underlined or not.
dimmed: bool
Get whether this is dimmed or not.
Note that the dimmed setting has no effect in a Windows console.
italic: bool
Get whether this is italic or not.
Note that the italic setting has no effect in a Windows console.
reset: bool
Get 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: bool
Get 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) -> Self
pub fn new(foreground: AnsiColor) -> Self
Create a new ColorSpec
with the foreground color specified.
sourcepub fn rgb(r: u8, g: u8, b: u8) -> Self
pub fn rgb(r: u8, g: u8, b: u8) -> Self
Create a new ColorSpec
with the foreground color specified.
sourcepub fn with_fg_color(self, color: AnsiColor) -> Self
pub fn with_fg_color(self, color: AnsiColor) -> Self
Create a new ColorSpec
with the foreground color specified.
sourcepub fn with_bg_color(self, color: AnsiColor) -> Self
pub fn with_bg_color(self, color: AnsiColor) -> Self
Create a new ColorSpec
with the background color specified.
sourcepub fn with_underline(self) -> Self
pub fn with_underline(self) -> Self
Create a new AnsiStyle
with underline enabled.
sourcepub fn with_italic(self) -> Self
pub fn with_italic(self) -> Self
Create a new AnsiStyle
with dimmed enabled.