Struct Color
pub struct Color {
pub r: f64,
pub g: f64,
pub b: f64,
pub a: f64,
}Expand description
sRGB color, 0.0–1.0 components. Semantic theme tokens (§6.3) resolve to these in the backend.
Fields§
§r: f64§g: f64§b: f64§a: f64Implementations§
§impl Color
impl Color
pub const BLACK: Color
pub const WHITE: Color
pub const CLEAR: Color
pub const fn rgba(r: f64, g: f64, b: f64, a: f64) -> Color
pub const fn rgb(r: f64, g: f64, b: f64) -> Color
pub fn hsl(h: f64, s: f64, l: f64) -> Color
pub fn hsl(h: f64, s: f64, l: f64) -> Color
From HSL — h in degrees (wraps mod 360), s/l in 0.0..=1.0. Color is the one color
type every parameter accepts, so this makes HSL usable everywhere a color is.
pub fn hsla(h: f64, s: f64, l: f64, a: f64) -> Color
pub fn hsva(h: f64, s: f64, v: f64, a: f64) -> Color
pub fn to_hsl(&self) -> (f64, f64, f64)
pub fn to_hsl(&self) -> (f64, f64, f64)
Decompose to (hue°, saturation, lightness) (HSL). Hue is 0.0 for greys.
pub fn lerp_hsl(self, to: Color, t: f64) -> Color
pub fn lerp_hsl(self, to: Color, t: f64) -> Color
Interpolate toward to in HSL space, taking the shortest hue arc (t in 0.0..=1.0). A
hue-space blend (red→green sweeps through yellow) rather than the muddy RGB straight line —
used by the canvas / self-driven animation path (native widget color animation interpolates
in the toolkit’s own space).
Trait Implementations§
impl Copy for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnsafeUnpin for Color
impl UnwindSafe for Color
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more