(hue: f32)
| 11 | } |
| 12 | |
| 13 | pub fn hue(hue: f32) -> Self { |
| 14 | let mut rgb = [0f32; 3]; |
| 15 | rgb.iter_mut().enumerate().for_each(|(i, c)| { |
| 16 | let h = hue + (i as f32) / 3.0; |
| 17 | *c = f32::clamp(6.0 * f32::abs(h - f32::floor(h) - 0.5) - 1.0, 0.0, 1.0); |
| 18 | }); |
| 19 | Self::new( |
| 20 | (rgb[0] * 255.0) as u8, |
| 21 | (rgb[1] * 255.0) as u8, |
| 22 | (rgb[2] * 255.0) as u8, |
| 23 | ) |
| 24 | } |
| 25 | |
| 26 | pub const BLACK: Color = Color::new(0x00, 0x00, 0x00); |
| 27 | pub const DARK_BLUE: Color = Color::new(0x00, 0x00, 0xAA); |
nothing calls this directly
no outgoing calls
no test coverage detected