Trait TermColor

Source
pub trait TermColor {
    // Required methods
    fn brightness(&self) -> f32;
    fn brighter_than(&self, other: Color) -> bool;
}
Expand description

Adds brightness functions to PistonWindow’s Color type

Required Methods§

Source

fn brightness(&self) -> f32

Uses a weighted color axis to determine percieved brightness of a color.

assert_eq!(EMERALD.brightness(), 0.6626567);
Source

fn brighter_than(&self, other: Color) -> bool

Returns true if this color is brighter than the given other color.

assert!(LIGHT_PURPLE.brighter_than(DARK_PURPLE));

Implementations on Foreign Types§

Source§

impl TermColor for Color

Source§

fn brighter_than(&self, other: Color) -> bool

Source§

fn brightness(&self) -> f32

Implementors§