Enum coolor::Color

source ·
pub enum Color {
    Ansi(AnsiColor),
    Hsl(Hsl),
    Rgb(Rgb),
}
Expand description

Color type, may be Ansi, Hsl or Rgb

Variants§

§

Ansi(AnsiColor)

§

Hsl(Hsl)

§

Rgb(Rgb)

Implementations§

source§

impl Color

source

pub fn ansi(self) -> AnsiColor

source

pub fn hsl(self) -> Hsl

source

pub fn rgb(self) -> Rgb

source

pub fn luma(self) -> f32

source

pub fn blend<C1: Into<Color>, C2: Into<Color>>( c1: C1, w1: f32, c2: C2, w2: f32 ) -> Self

compute a natural feeling intermediate between two colors

Trait Implementations§

source§

impl Clone for Color

source§

fn clone(&self) -> Color

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Color

source§

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

Formats the value using the given formatter. Read more
source§

impl From<AnsiColor> for Color

source§

fn from(ansi: AnsiColor) -> Self

Converts to this type from the input type.
source§

impl From<Hsl> for Color

source§

fn from(rgb: Hsl) -> Self

Converts to this type from the input type.
source§

impl From<Rgb> for Color

source§

fn from(rgb: Rgb) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Color

source§

fn from(code: u8) -> Self

Converts to this type from the input type.
source§

impl Copy 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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.