pub enum Color {
Black,
Blue,
Green,
Red,
Cyan,
Magenta,
Yellow,
White,
Ansi256(u8),
Rgb(u8, u8, u8),
// some variants omitted
}
Expand description
The set of available colors for the terminal foreground/background.
The Ansi256
and Rgb
colors will only output the correct codes when
paired with the Ansi
WriteColor
implementation.
The Ansi256
and Rgb
color types are not supported when writing colors
on Windows using the console. If they are used on Windows, then they are
silently ignored and no colors will be emitted.
This set may expand over time.
This type has a FromStr
impl that can parse colors from their human
readable form. The format is as follows:
- Any of the explicitly listed colors in English. They are matched case insensitively.
- A single 8-bit integer, in either decimal or hexadecimal format.
- A triple of 8-bit integers separated by a comma, where each integer is in decimal or hexadecimal format.
Hexadecimal numbers are written with a 0x
prefix.
Variants
Black
Blue
Green
Red
Cyan
Magenta
Yellow
White
Ansi256(u8)
Rgb(u8, u8, u8)
Trait Implementations
sourceimpl FromStr for Color
impl FromStr for Color
type Err = ParseColorError
type Err = ParseColorError
The associated error which can be returned from parsing.
impl Copy for Color
impl Eq for Color
impl StructuralEq for Color
impl StructuralPartialEq for Color
Auto Trait Implementations
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more