Skip to main content

rgb_to_hsl

Function rgb_to_hsl 

pub fn rgb_to_hsl(c: AlphaColor<Srgb>) -> (f32, f32, f32)
Expand description

sRGB → HSL: (hue_degrees, s, l). Straight sRGB rather than a perceptual space; hue and saturation are 0 on the achromatic axis.

use tilo_ui::color::rgb_to_hsl;
use tilo_ui::vello::peniko::Color;
assert_eq!(rgb_to_hsl(Color::from_rgb8(255, 0, 0)), (0.0, 1.0, 0.5));