Skip to main content

rgb_to_hsv

Function rgb_to_hsv 

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

Inverse of hsv_to_rgb: (hue_degrees, s, v). Hue is 0 on the achromatic axis — a caller editing a grey should keep its prior hue rather than rely on this fallback.

use tilo_ui::color::rgb_to_hsv;
use tilo_ui::vello::peniko::Color;
assert_eq!(rgb_to_hsv(Color::from_rgb8(0, 0, 255)), (240.0, 1.0, 1.0));