#[repr(u8)]
pub enum AnsiColor {
Show 16 variants
Black,
Red,
Green,
Yellow,
Blue,
Magenta,
Cyan,
White,
BrightBlack,
BrightRed,
BrightGreen,
BrightYellow,
BrightBlue,
BrightMagenta,
BrightCyan,
BrightWhite,
}Expand description
Available 4-bit ANSI color palette codes
The user’s terminal defines the meaning of the each palette code.
Variants§
Black
Black: #0 (foreground code 30, background code 40).
Red
Red: #1 (foreground code 31, background code 41).
Green
Green: #2 (foreground code 32, background code 42).
Yellow
Yellow: #3 (foreground code 33, background code 43).
Blue
Blue: #4 (foreground code 34, background code 44).
Magenta
Magenta: #5 (foreground code 35, background code 45).
Cyan
Cyan: #6 (foreground code 36, background code 46).
White
White: #7 (foreground code 37, background code 47).
BrightBlack
Bright black: #0 (foreground code 90, background code 100).
BrightRed
Bright red: #1 (foreground code 91, background code 101).
BrightGreen
Bright green: #2 (foreground code 92, background code 102).
BrightYellow
Bright yellow: #3 (foreground code 93, background code 103).
BrightBlue
Bright blue: #4 (foreground code 94, background code 104).
BrightMagenta
Bright magenta: #5 (foreground code 95, background code 105).
BrightCyan
Bright cyan: #6 (foreground code 96, background code 106).
BrightWhite
Bright white: #7 (foreground code 97, background code 107).
Implementations§
source§impl AnsiColor
impl AnsiColor
sourcepub fn on(self, background: impl Into<Color>) -> Style
pub fn on(self, background: impl Into<Color>) -> Style
Create a Style with this as the foreground
sourcepub const fn on_default(self) -> Style
pub const fn on_default(self) -> Style
Create a Style with this as the foreground
sourcepub fn render_fg(self) -> impl Display + Copy + Clone
pub fn render_fg(self) -> impl Display + Copy + Clone
Render the ANSI code for a foreground color
Trait Implementations§
source§impl From<AnsiColor> for Ansi256Color
impl From<AnsiColor> for Ansi256Color
source§impl Ord for AnsiColor
impl Ord for AnsiColor
source§impl PartialEq<AnsiColor> for AnsiColor
impl PartialEq<AnsiColor> for AnsiColor
source§impl PartialOrd<AnsiColor> for AnsiColor
impl PartialOrd<AnsiColor> for AnsiColor
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more