pre generate grayscale palettes

This commit is contained in:
🪞👃🪞 2025-01-19 22:16:39 +01:00
parent cfa3cad5cb
commit ee28d431bd
7 changed files with 16 additions and 12 deletions

View file

@ -73,6 +73,14 @@ impl ItemColor {
pub darkest: ItemColor,
}
impl ItemPalette {
pub const G: [Self;256] = {
let mut builder = konst::ArrayBuilder::new();
let mut index = 0;
while !builder.is_full() {
builder.push(ItemPalette::G[index]);
index++;
}
};
pub fn random () -> Self { ItemColor::random().into() }
pub fn random_near (color: Self, distance: f32) -> Self {
color.base.mix(ItemColor::random(), distance).into()