Enum AnsiColor
#[repr(u8)]
pub enum AnsiColor
Available 4-bit ANSI color palette codes
The user's terminal defines the meaning of each palette code.
Variants
-
Black Black: #0 (foreground code
30, background code40).-
Red Red: #1 (foreground code
31, background code41).-
Green Green: #2 (foreground code
32, background code42).-
Yellow Yellow: #3 (foreground code
33, background code43).-
Blue Blue: #4 (foreground code
34, background code44).-
Magenta Magenta: #5 (foreground code
35, background code45).-
Cyan Cyan: #6 (foreground code
36, background code46).-
White White: #7 (foreground code
37, background code47).-
BrightBlack Bright black: #0 (foreground code
90, background code100).-
BrightRed Bright red: #1 (foreground code
91, background code101).-
BrightGreen Bright green: #2 (foreground code
92, background code102).-
BrightYellow Bright yellow: #3 (foreground code
93, background code103).-
BrightBlue Bright blue: #4 (foreground code
94, background code104).-
BrightMagenta Bright magenta: #5 (foreground code
95, background code105).-
BrightCyan Bright cyan: #6 (foreground code
96, background code106).-
BrightWhite Bright white: #7 (foreground code
97, background code107).
Implementations
impl AnsiColor
fn on(self, background: impl Into<Color>) -> StyleCreate a [
Style][crate::Style] with this as the foregroundconst fn on_default(self) -> StyleCreate a [
Style][crate::Style] with this as the foregroundfn render_fg(self) -> impl Display + CopyRender the ANSI code for a foreground color
fn render_bg(self) -> impl Display + CopyRender the ANSI code for a background color
fn bright(self, yes: bool) -> SelfChange the color to/from bright
fn is_bright(self) -> boolReport whether the color is bright
Trait Implementations
impl Clone for AnsiColor
fn clone(&self) -> Self
impl Copy for AnsiColor
impl Debug for AnsiColor
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for AnsiColor
impl Hash for AnsiColor
fn hash<__H: Hasher>(&self, state: &mut __H)
impl Ord for AnsiColor
fn cmp(&self, other: &Self) -> Ordering
impl PartialEq for AnsiColor
fn eq(&self, other: &Self) -> bool
impl PartialOrd for AnsiColor
fn partial_cmp(&self, other: &Self) -> Option<Ordering>