[][src]Enum conrod_core::color::Color

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

Color supporting RGB and HSL variants.

Variants

Rgba(f32f32f32f32)

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

Hsla(f32f32f32f32)

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

Implementations

impl Color[src]

pub fn complement(self) -> Color[src]

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

pub fn luminance(&self) -> f32[src]

Calculate and return the luminance of the Color.

pub fn plain_contrast(self) -> Color[src]

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.

pub fn to_hsl(self) -> Hsla[src]

Extract the components of a color in the HSL format.

pub fn to_rgb(self) -> Rgba[src]

Extract the components of a color in the RGB format.

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

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

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

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

pub fn with_luminance(self, l: f32) -> Color[src]

Return the same color but with the given luminance.

pub fn alpha(self, alpha: f32) -> Color[src]

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

pub fn with_alpha(self, a: f32) -> Color[src]

Return the same color but with the given alpha.

pub fn highlighted(self) -> Color[src]

Return a highlighted version of the current Color.

pub fn clicked(&self) -> Color[src]

Return a clicked version of the current Color.

pub fn invert(self) -> Color[src]

Return the Color's invert.

pub fn red(&self) -> f32[src]

Return the red value.

pub fn green(&self) -> f32[src]

Return the green value.

pub fn blue(&self) -> f32[src]

Return the blue value.

pub fn set_red(&mut self, r: f32)[src]

Set the red value.

pub fn set_green(&mut self, g: f32)[src]

Set the green value.

pub fn set_blue(&mut self, b: f32)[src]

Set the blue value.

Trait Implementations

impl Clone for Color[src]

impl Copy for Color[src]

impl Debug for Color[src]

impl From<Color> for Hsla[src]

impl From<Color> for Rgba[src]

impl From<Hsla> for Color[src]

impl From<Rgba> for Color[src]

impl PartialEq<Color> for Color[src]

impl StructuralPartialEq for Color[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Style for T where
    T: Any + Debug + PartialEq<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.