pub enum Color {
}Expand description
Represents a terminal color.
Variants§
Default
Default terminal color
Black
Black color
Red
Red color
Green
Green color
Yellow
Yellow color
Blue
Blue color
Magenta
Magenta color
Cyan
Cyan color
White
White color
BrightBlack
Bright black (gray)
BrightRed
Bright red
BrightGreen
Bright green
BrightYellow
Bright yellow
BrightBlue
Bright blue
BrightMagenta
Bright magenta
BrightCyan
Bright cyan
BrightWhite
Bright white
Ansi256(u8)
256-color palette (0-255)
Rgb
True color RGB
Implementations§
Source§impl Color
impl Color
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Parse a color from a string.
Supports:
- Named colors: “red”, “blue”, “bright_red”, etc.
- Hex colors: “#ff0000”, “#f00”
- RGB: “rgb(255, 0, 0)”
- 256-color: “color(196)”
Sourcepub fn to_crossterm(&self) -> Color
pub fn to_crossterm(&self) -> Color
Convert to crossterm color.
Sourcepub fn to_ansi256(&self) -> Self
pub fn to_ansi256(&self) -> Self
Convert to 256-color palette.
Sourcepub fn to_standard(&self) -> Self
pub fn to_standard(&self) -> Self
Convert to standard 8/16-color ANSI.
Trait Implementations§
impl Copy for Color
impl Eq for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more