Enum nannou::ui::Color [−][src]
Color supporting RGB and HSL variants.
Variants
Rgba(f32, f32, f32, f32)
Red, Green, Blue, Alpha - All values' scales represented between 0.0 and 1.0.
Hsla(f32, f32, f32, f32)
Hue, Saturation, Lightness, Alpha - all valuess scales represented between 0.0 and 1.0.
Methods
impl Color
[src]
impl Color
pub fn complement(self) -> Color
[src]
pub 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.
pub fn luminance(&self) -> f32
[src]
pub fn luminance(&self) -> f32
Calculate and return the luminance of the Color.
pub fn plain_contrast(self) -> Color
[src]
pub 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.
pub fn to_hsl(self) -> Hsla
[src]
pub fn to_hsl(self) -> Hsla
Extract the components of a color in the HSL format.
pub fn to_rgb(self) -> Rgba
[src]
pub fn to_rgb(self) -> Rgba
Extract the components of a color in the RGB format.
pub fn to_fsa(self) -> [f32; 4]
[src]
pub fn to_fsa(self) -> [f32; 4]
Extract the components of a color in the RGB format within a fixed-size array.
pub fn to_byte_fsa(self) -> [u8; 4]
[src]
pub fn to_byte_fsa(self) -> [u8; 4]
Same as to_fsa
, except r, g, b and a are represented in byte form.
pub fn with_luminance(self, l: f32) -> Color
[src]
pub fn with_luminance(self, l: f32) -> Color
Return the same color but with the given luminance.
pub fn alpha(self, alpha: f32) -> Color
[src]
pub fn alpha(self, alpha: f32) -> Color
Return the same color but with the alpha multiplied by the given alpha.
pub fn with_alpha(self, a: f32) -> Color
[src]
pub fn with_alpha(self, a: f32) -> Color
Return the same color but with the given alpha.
pub fn highlighted(self) -> Color
[src]
pub fn highlighted(self) -> Color
Return a highlighted version of the current Color.
pub fn clicked(&self) -> Color
[src]
pub fn clicked(&self) -> Color
Return a clicked version of the current Color.
pub fn invert(self) -> Color
[src]
pub fn invert(self) -> Color
Return the Color's invert.
pub fn red(&self) -> f32
[src]
pub fn red(&self) -> f32
Return the red value.
pub fn green(&self) -> f32
[src]
pub fn green(&self) -> f32
Return the green value.
pub fn blue(&self) -> f32
[src]
pub fn blue(&self) -> f32
Return the blue value.
pub fn set_red(&mut self, r: f32)
[src]
pub fn set_red(&mut self, r: f32)
Set the red value.
pub fn set_green(&mut self, g: f32)
[src]
pub fn set_green(&mut self, g: f32)
Set the green value.
pub fn set_blue(&mut self, b: f32)
[src]
pub fn set_blue(&mut self, b: f32)
Set the blue value.
Trait Implementations
impl Clone for Color
[src]
impl Clone for Color
fn clone(&self) -> Color
[src]
fn clone(&self) -> Color
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Color
[src]
impl Debug for Color
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl From<Color> for Rgba
[src]
impl From<Color> for Rgba
impl From<Hsla> for Color
[src]
impl From<Hsla> for Color
impl From<Rgba> for Color
[src]
impl From<Rgba> for Color
impl From<Color> for Hsla
[src]
impl From<Color> for Hsla
impl Copy for Color
[src]
impl Copy for Color
impl PartialEq<Color> for Color
[src]
impl PartialEq<Color> for Color