#[repr(C)]pub struct Color {
pub red: f32,
pub green: f32,
pub blue: f32,
pub alpha: f32,
}
Expand description
Basic color representation
Fields§
§red: f32
Red component
green: f32
Green component
blue: f32
Blue component
alpha: f32
Alpha component
Implementations§
Source§impl Color
impl Color
Sourcepub fn new(red: f32, green: f32, blue: f32, alpha: f32) -> Self
pub fn new(red: f32, green: f32, blue: f32, alpha: f32) -> Self
Create color with floating point components
Sourcepub fn hsl(hue: f32, saturation: f32, lightness: f32) -> Self
pub fn hsl(hue: f32, saturation: f32, lightness: f32) -> Self
Create solid color with using hsl color space
Sourcepub fn hsla(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Self
pub fn hsla(hue: f32, saturation: f32, lightness: f32, alpha: f32) -> Self
Create solid color with using hsl color space and alpha component
Sourcepub fn hsv(hue: f32, saturation: f32, value: f32) -> Self
pub fn hsv(hue: f32, saturation: f32, value: f32) -> Self
Create solid color with using hsv color space
Sourcepub fn hsva(hue: f32, saturation: f32, value: f32, alpha: f32) -> Self
pub fn hsva(hue: f32, saturation: f32, value: f32, alpha: f32) -> Self
Create solid color with using hsv color space and alpha component
Sourcepub fn cmyk(cyan: f32, magenta: f32, yellow: f32, key: f32) -> Self
pub fn cmyk(cyan: f32, magenta: f32, yellow: f32, key: f32) -> Self
Create solid color with using cmyk color space
Sourcepub fn cmyka(cyan: f32, magenta: f32, yellow: f32, key: f32, alpha: f32) -> Self
pub fn cmyka(cyan: f32, magenta: f32, yellow: f32, key: f32, alpha: f32) -> Self
Create solid color with using cmyk color space and alpha component
Sourcepub fn cmy(cyan: f32, magenta: f32, yellow: f32) -> Self
pub fn cmy(cyan: f32, magenta: f32, yellow: f32) -> Self
Create solid color with using cmy color space
Sourcepub fn cmya(cyan: f32, magenta: f32, yellow: f32, alpha: f32) -> Self
pub fn cmya(cyan: f32, magenta: f32, yellow: f32, alpha: f32) -> Self
Create solid color with using cmy color space and alpha component
Sourcepub fn RGB(red: u8, green: u8, blue: u8) -> Self
👎Deprecated
pub fn RGB(red: u8, green: u8, blue: u8) -> Self
Create solid color with using rgb color space
Sourcepub fn RGBA(red: u8, green: u8, blue: u8, alpha: u8) -> Self
👎Deprecated
pub fn RGBA(red: u8, green: u8, blue: u8, alpha: u8) -> Self
Create solid color with using lab rgb space and alpha component
Sourcepub fn HSL(hue: f32, saturation: f32, lightness: f32) -> Self
👎Deprecated
pub fn HSL(hue: f32, saturation: f32, lightness: f32) -> Self
Create solid color with using hsl color space
Sourcepub fn HSV(hue: f32, saturation: f32, value: f32) -> Self
👎Deprecated
pub fn HSV(hue: f32, saturation: f32, value: f32) -> Self
Create solid color with using hsv color space