Struct inku::Color [−][src]
pub struct Color(_);
Expand description
An RGB color backed by a u32
.
Example:
use inku::Color; let color = Color::new(0x000000); // Lighten the color by 10% let lighter_color = color.lighten(0.1); assert_eq!(lighter_color.to_u32(), 0x191919);
Implementations
Initializes a new Color
from a u32
.
The u32
is treated as follows:
0x00000000
^^ ignored
^^ red
^^ green
^^ blue
Lightens the color by translating to HSL color space then adjusting the lightness value.
Panics
Panics if percent
is not between 0.0
and 1.0
Darkens the color by translating to HSL color space then adjusting the lightness value.
Panics
Panics if percent
is not between 0.0
and 1.0
Increases saturation of the color by translating to HSL color space then adjusting the saturation value.
Panics
Panics if percent
is not between 0.0
and 1.0
Decreases saturation of the color by translating to HSL color space then adjusting the saturation value.
Panics
Panics if percent
is not between 0.0
and 1.0
Rotate the hue by translating to HSL color space then adjusting the hue value. Takes a
value between 0.0
and 360.0
.
Panics
Panics if amount
is less than 0.0
The percieved brightness of the color (a
number between 0.0
and 1.0
).
Determine whether a color is perceived as a light color (percieved
brightness is greater than 0.5
).
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Color
impl UnwindSafe for Color
Blanket Implementations
Mutably borrows from an owned value. Read more