Enum nannou::ui::Color
[−]
[src]
pub enum Color { Rgba(f32, f32, f32, f32), Hsla(f32, f32, f32, f32), }
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]
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 Copy for Color
[src]
impl PartialEq<Color> for Color
[src]
fn eq(&self, __arg_0: &Color) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Color) -> bool
[src]
This method tests for !=
.
impl Clone for Color
[src]
fn clone(&self) -> Color
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more