Trait surf_n_term::color::Color[][src]

pub trait Color: From<ColorLinear> + Into<ColorLinear> + Copy {
    fn rgba_u8(self) -> [u8; 4];

    fn rgb_u8(self) -> [u8; 3] { ... }
fn blend(self, other: impl Color, method: Blend) -> Self { ... }
fn lerp(self, other: impl Color, t: f64) -> Self { ... }
fn luma(self) -> f64 { ... }
fn best_contrast(self, c0: impl Color, c1: impl Color) -> Self { ... } }

Required methods

fn rgba_u8(self) -> [u8; 4][src]

Convert color into 32-bit sRGB array with alpha (channels are not pre-multiplied).

Loading content...

Provided methods

fn rgb_u8(self) -> [u8; 3][src]

Convert color into 24-bit sRGB array without alpha (channels are not pre-multiplied).

fn blend(self, other: impl Color, method: Blend) -> Self[src]

Blend current color with the other color, with the specified blend method.

fn lerp(self, other: impl Color, t: f64) -> Self[src]

Linear interpolation between self and other colors.

fn luma(self) -> f64[src]

Calculate luma of the color.

fn best_contrast(self, c0: impl Color, c1: impl Color) -> Self[src]

Pick color that produces the best contrast with self

Loading content...

Implementors

Loading content...