Enum clap_builder::builder::styling::AnsiColor
source · #[repr(u8)]pub enum AnsiColor {
Show 16 variants
Black = 0,
Red = 1,
Green = 2,
Yellow = 3,
Blue = 4,
Magenta = 5,
Cyan = 6,
White = 7,
BrightBlack = 8,
BrightRed = 9,
BrightGreen = 10,
BrightYellow = 11,
BrightBlue = 12,
BrightMagenta = 13,
BrightCyan = 14,
BrightWhite = 15,
}
Expand description
Available 4-bit ANSI color palette codes
The user’s terminal defines the meaning of the each palette code.
Variants§
Black = 0
Black: #0 (foreground code 30
, background code 40
).
Red = 1
Red: #1 (foreground code 31
, background code 41
).
Green = 2
Green: #2 (foreground code 32
, background code 42
).
Yellow = 3
Yellow: #3 (foreground code 33
, background code 43
).
Blue = 4
Blue: #4 (foreground code 34
, background code 44
).
Magenta = 5
Magenta: #5 (foreground code 35
, background code 45
).
Cyan = 6
Cyan: #6 (foreground code 36
, background code 46
).
White = 7
White: #7 (foreground code 37
, background code 47
).
BrightBlack = 8
Bright black: #0 (foreground code 90
, background code 100
).
BrightRed = 9
Bright red: #1 (foreground code 91
, background code 101
).
BrightGreen = 10
Bright green: #2 (foreground code 92
, background code 102
).
BrightYellow = 11
Bright yellow: #3 (foreground code 93
, background code 103
).
BrightBlue = 12
Bright blue: #4 (foreground code 94
, background code 104
).
BrightMagenta = 13
Bright magenta: #5 (foreground code 95
, background code 105
).
BrightCyan = 14
Bright cyan: #6 (foreground code 96
, background code 106
).
BrightWhite = 15
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§fn from(inner: AnsiColor) -> Ansi256Color
fn from(inner: AnsiColor) -> Ansi256Color
source§impl Ord for AnsiColor
impl Ord for AnsiColor
source§impl PartialEq for AnsiColor
impl PartialEq for AnsiColor
source§impl PartialOrd for AnsiColor
impl PartialOrd 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