Enum Color

pub enum Color

Any ANSI color code scheme

Variants

Ansi(AnsiColor)

Available 4-bit ANSI color palette codes

The user's terminal defines the meaning of each palette code.

Ansi256(Ansi256Color)

256 (8-bit) color support

Rgb(RgbColor)

24-bit ANSI RGB color codes

Implementations

impl Color

fn on(self, background: impl Into<Color>) -> Style

Create a [Style][crate::Style] with this as the foreground

const fn on_default(self) -> Style

Create a [Style][crate::Style] with this as the foreground

fn render_fg(self) -> impl Display + Copy

Render the ANSI code for a foreground color

fn render_bg(self) -> impl Display + Copy

Render the ANSI code for a background color

Trait Implementations

impl Clone for Color

fn clone(&self) -> Self

impl Copy for Color

impl Debug for Color

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Eq for Color

impl From<(u8, u8, u8)> for Color

fn from(inner: (u8, u8, u8)) -> Self

impl From<Ansi256Color> for Color

fn from(inner: Ansi256Color) -> Self

impl From<AnsiColor> for Color

fn from(inner: AnsiColor) -> Self

impl From<RgbColor> for Color

fn from(inner: RgbColor) -> Self

impl From<u8> for Color

fn from(inner: u8) -> Self

impl Hash for Color

fn hash<__H: Hasher>(&self, state: &mut __H)

impl Ord for Color

fn cmp(&self, other: &Self) -> Ordering

impl PartialEq for Color

fn eq(&self, other: &Self) -> bool

impl PartialOrd for Color

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

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 UnsafeUnpin for Color

impl UnwindSafe for Color

Blanket Implementations

impl<T> Any for Color where T: 'static + ?Sized,

impl<T> Borrow<T> for Color where T: ?Sized,

impl<T> BorrowMut<T> for Color where T: ?Sized,

impl<T> CloneToUninit for Color where T: Clone,

impl<T> From<T> for Color

impl<T> ToOwned for Color where T: Clone,

impl<T, U> Into<U> for Color where U: From<T>,

impl<T, U> TryFrom<U> for Color where U: Into<T>,

impl<T, U> TryInto<U> for Color where U: TryFrom<T>,