mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
pre generate grayscale palettes
This commit is contained in:
parent
cfa3cad5cb
commit
ee28d431bd
7 changed files with 16 additions and 12 deletions
|
|
@ -9,6 +9,7 @@ rand = "0.8.5"
|
|||
crossterm = "0.28.1"
|
||||
ratatui = { version = "0.29.0", features = [ "unstable-widget-ref", "underline-color" ] }
|
||||
better-panic = "0.3.0"
|
||||
konst = { version = "0.3.16", features = [ "rust_1_83" ] }
|
||||
|
||||
tek_edn = { path = "../edn" }
|
||||
tek_input = { path = "../input" }
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue