Add a rudimentary state color builder

This commit is contained in:
Nate Butler 2024-01-16 00:07:06 -05:00
parent 8c9f3a7322
commit bdb06f183b
4 changed files with 58 additions and 8 deletions

View file

@ -34,6 +34,7 @@ story = { path = "../story", optional = true }
toml.workspace = true
uuid.workspace = true
util = { path = "../util" }
color = {path = "../color"}
itertools = { version = "0.11.0", optional = true }
[dev-dependencies]

View file

@ -147,3 +147,10 @@ pub fn color_alpha(color: Hsla, alpha: f32) -> Hsla {
color.a = alpha;
color
}
pub fn to_gpui_hsla(color: color::Color) -> gpui::Hsla {
let hsla = color.value();
let hue: f32 = hsla.hue.into();
gpui::hsla(hue / 360.0, hsla.saturation, hsla.lightness, hsla.alpha)
}