[][src]Enum crossterm::style::Colored

pub enum Colored {
    ForegroundColor(Color),
    BackgroundColor(Color),
}

Represents a foreground or background color.

This can be converted to a Colors by calling into() and applied using the SetColors command.

Variants

ForegroundColor(Color)

A foreground color.

BackgroundColor(Color)

A background color.

Implementations

impl Colored[src]

pub fn parse_ansi(ansi: &str) -> Option<Self>[src]

Parse an ANSI foreground or background color. This is the string that would appear within an ESC [ <str> m escape sequence, as found in various configuration files.

For example: 38;5;0 -> ForegroundColor(Black), 38;5;26 -> ForegroundColor(AnsiValue(26)) 48;2;50;60;70 -> BackgroundColor(Rgb(50, 60, 70)) 49 -> BackgroundColor(Reset) Invalid sequences map to None.

Currently, 3/4 bit color values aren't supported so return None.

See also: Color::parse_ansi

Trait Implementations

impl Clone for Colored[src]

impl Copy for Colored[src]

impl Debug for Colored[src]

impl<'de> Deserialize<'de> for Colored[src]

impl Display for Colored[src]

impl Eq for Colored[src]

impl From<Colored> for Colors[src]

impl Hash for Colored[src]

impl Ord for Colored[src]

impl PartialEq<Colored> for Colored[src]

impl PartialOrd<Colored> for Colored[src]

impl Serialize for Colored[src]

impl StructuralEq for Colored[src]

impl StructuralPartialEq for Colored[src]

Auto Trait Implementations

impl RefUnwindSafe for Colored

impl Send for Colored

impl Sync for Colored

impl Unpin for Colored

impl UnwindSafe for Colored

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.