(from: u8, to: u8, alpha: f32)
| 177 | } |
| 178 | |
| 179 | fn mix_u8(from: u8, to: u8, alpha: f32) -> u8 { |
| 180 | let from = from as f32; |
| 181 | let to = to as f32; |
| 182 | (from + (to - from) * alpha).round().clamp(0.0, 255.0) as u8 |
| 183 | } |
| 184 | |
| 185 | fn color_to_rgb(color: Color) -> (u8, u8, u8) { |
| 186 | match color { |