Enum conrod::Color [−] [src]

pub enum Color {
    Rgba(f32, f32, f32, f32),
    Hsla(f32, f32, f32, f32),
}

Color supporting RGB and HSL variants.

Variants

Rgba

Red, Green, Blue, Alpha - All values' scales represented between 0.0 and 1.0.

Hsla

Hue, Saturation, Lightness, Alpha - all valuess scales represented between 0.0 and 1.0.

Methods

impl Color

fn complement(self) -> Color

Produce a complementary color. The two colors will accent each other. This is the same as rotating the hue by 180 degrees.

fn luminance(&self) -> f32

Calculate and return the luminance of the Color.

fn plain_contrast(self) -> Color

Return either black or white, depending which contrasts the Color the most. This will be useful for determining a readable color for text on any given background Color.

fn to_hsl(self) -> Hsla

Extract the components of a color in the HSL format.

fn to_rgb(self) -> Rgba

Extract the components of a color in the RGB format.

fn to_fsa(self) -> [f32; 4]

Extract the components of a color in the RGB format within a fixed-size array.

fn to_byte_fsa(self) -> [u8; 4]

Same as to_fsa, except r, g, b and a are represented in byte form.

fn to_hex(self) -> String

Return the hex representation of this color in the format #RRGGBBAA e.g. Color(1.0, 0.0, 5.0, 1.0) == "#FF0080FF"

fn with_luminance(self, l: f32) -> Color

Return the same color but with the given luminance.

fn alpha(self, alpha: f32) -> Color

Return the same color but with the alpha multiplied by the given alpha.

fn with_alpha(self, a: f32) -> Color

Return the same color but with the given alpha.

fn highlighted(self) -> Color

Return a highlighted version of the current Color.

fn clicked(&self) -> Color

Return a clicked version of the current Color.

fn invert(self) -> Color

Return the Color's invert.

fn red(&self) -> f32

Return the red value.

fn green(&self) -> f32

Return the green value.

fn blue(&self) -> f32

Return the blue value.

fn set_red(&mut self, r: f32)

Set the red value.

fn set_green(&mut self, g: f32)

Set the green value.

fn set_blue(&mut self, b: f32)

Set the blue value.

Trait Implementations

Derived Implementations

impl Decodable for Color

fn decode<__D>(__arg_0: &mut __D) -> Result<Color, __D::Error> where __D: Decoder

impl Encodable for Color

fn encode<__S>(&self, __arg_0: &mut __S) -> Result<(), __S::Error> where __S: Encoder

impl Debug for Color

fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>

impl Clone for Color

fn clone(&self) -> Color

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

impl Copy for Color

impl PartialEq<Color> for Color

fn eq(&self, __arg_0: &Color) -> bool

fn ne(&self, __arg_0: &Color) -> bool