Skip to main content

hsv_to_rgb

Function hsv_to_rgb 

pub fn hsv_to_rgb(h: f32, s: f32, v: f32) -> AlphaColor<Srgb>
Expand description

HSV → opaque sRGB. h in degrees (any range; wrapped), s and v clamped to [0, 1].

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