fix(draw): mismatches
Some checks failed
/ build (push) Has been cancelled

This commit is contained in:
same mf who else 2026-03-25 22:39:39 +02:00
parent 30d378a6ee
commit bea88ac58d
5 changed files with 27 additions and 15 deletions

View file

@ -6,7 +6,10 @@ pub(crate) use ::palette::{
};
use rand::distributions::uniform::UniformSampler;
pub fn rgb (r: u8, g: u8, b: u8) -> ItemColor { todo!(); }
pub fn rgb (r: u8, g: u8, b: u8) -> ItemColor {
let term = Color::Rgb(r, g, b);
ItemColor { okhsl: rgb_to_okhsl(term), term }
}
pub fn okhsl_to_rgb (color: Okhsl<f32>) -> Color {
let Srgb { red, green, blue, .. }: Srgb<f32> = Srgb::from_color_unclamped(color);
@ -30,10 +33,10 @@ pub trait HasColor { fn color (&self) -> ItemColor; }
}
}
#[derive(Copy, Clone, Debug, Default)]
#[derive(Copy, Clone, Debug, Default, PartialEq)]
pub struct ItemColor {
term: Color,
okhsl: Okhsl<f32>
pub term: Color,
pub okhsl: Okhsl<f32>
}
impl_from!(ItemColor: |term: Color| Self { term, okhsl: rgb_to_okhsl(term) });
impl_from!(ItemColor: |okhsl: Okhsl<f32>| Self { okhsl, term: okhsl_to_rgb(okhsl) });
@ -63,6 +66,7 @@ impl ItemColor {
}
}
#[derive(Copy, Clone, Debug, Default, PartialEq)]
pub struct ItemTheme {
pub base: ItemColor,
pub light: ItemColor,