Enum Color
enum Color
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)
Implementations
impl Clone for Color
fn clone(self: &Self) -> Color
impl Copy for Color
impl Debug for Color
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl Eq for Color
impl Freeze for Color
impl FromStr for Color
fn from_str(s: &str) -> Result<Color, ParseColorError>
impl PartialEq for Color
fn eq(self: &Self, other: &Color) -> bool
impl RefUnwindSafe for Color
impl Send for Color
impl StructuralPartialEq for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
impl<T> Any for Color
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Color
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Color
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Color
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Color
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Color
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for Color
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Color
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Color
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>