AdaptableColor

Trait AdaptableColor 

Source
pub trait AdaptableColor {
    // Required methods
    fn as_rgb(&self) -> Option<RgbColor>;
    fn as_ansi_256(&self) -> Option<Ansi256Color>;
    fn as_ansi_16(&self) -> Option<AnsiColor>;
    fn from_ansi_256(color: Ansi256Color) -> Self;
    fn from_ansi_16(color: AnsiColor) -> Self;
}
Expand description

Represents a color that can be converted to each type of color level.

Required Methods§

Source

fn as_rgb(&self) -> Option<RgbColor>

Returns the color as an RgbColor if a compatible representation exists.

Source

fn as_ansi_256(&self) -> Option<Ansi256Color>

Returns the color as an Ansi256Color if a compatible representation exists.

Source

fn as_ansi_16(&self) -> Option<AnsiColor>

Returns the color as an AnsiColor if a compatible representation exists.

Source

fn from_ansi_256(color: Ansi256Color) -> Self

Creates a new instance from an Ansi256Color.

Source

fn from_ansi_16(color: AnsiColor) -> Self

Creates a new instance from an AnsiColor.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl AdaptableColor for Color

Available on crate feature convert only.
Source§

impl AdaptableColor for Color

Available on crate features ratatui and convert only.

Implementors§