pub enum Color {
Black,
Blue,
Green,
Red,
Cyan,
Magenta,
Yellow,
White,
Ansi256(u8),
Rgb(u8, u8, u8),
}
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 (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Trait Implementations§
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§
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