use kael::*;
pub const ASTRYX_EASE: [f32; 4] = [0.24, 1.0, 0.4, 1.0];
pub const CHART_PALETTE: [u32; 8] = [
0x0064E0, 0x0D8626, 0xEB6E00, 0xE3193B, 0x5B08D8, 0x08A3A3, 0xC2185B, 0xC58600,
];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
pub enum ControlSize {
Sm,
#[default]
Md,
Lg,
}
impl ControlSize {
pub fn height(self) -> Pixels {
match self {
ControlSize::Sm => px(28.0),
ControlSize::Md => px(32.0),
ControlSize::Lg => px(36.0),
}
}
pub fn padding_x(self) -> Pixels {
match self {
ControlSize::Sm => px(10.0),
ControlSize::Md => px(12.0),
ControlSize::Lg => px(16.0),
}
}
pub fn gap(self) -> Pixels {
match self {
ControlSize::Sm => px(6.0),
ControlSize::Md | ControlSize::Lg => px(8.0),
}
}
pub fn font_size(self) -> Pixels {
match self {
ControlSize::Sm => px(13.0),
ControlSize::Md | ControlSize::Lg => px(14.0),
}
}
pub fn icon_size(self) -> Pixels {
match self {
ControlSize::Sm | ControlSize::Md => px(16.0),
ControlSize::Lg => px(20.0),
}
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Hue {
Blue,
Cyan,
Gray,
Green,
Orange,
Pink,
Purple,
Red,
Teal,
Yellow,
}
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct HueColors {
pub background: Hsla,
pub border: Hsla,
pub text: Hsla,
}
impl Hue {
pub const ALL: [Hue; 10] = [
Hue::Blue,
Hue::Cyan,
Hue::Gray,
Hue::Green,
Hue::Orange,
Hue::Pink,
Hue::Purple,
Hue::Red,
Hue::Teal,
Hue::Yellow,
];
pub fn label(self) -> &'static str {
match self {
Hue::Blue => "Blue",
Hue::Cyan => "Cyan",
Hue::Gray => "Gray",
Hue::Green => "Green",
Hue::Orange => "Orange",
Hue::Pink => "Pink",
Hue::Purple => "Purple",
Hue::Red => "Red",
Hue::Teal => "Teal",
Hue::Yellow => "Yellow",
}
}
pub fn colors(self, dark: bool) -> HueColors {
let (bg, border, text) = match (self, dark) {
(Hue::Blue, false) => (0x0171E333, 0x0064E0FF, 0x042F97FF),
(Hue::Blue, true) => (0x0171E333, 0x2694FEFF, 0xAFD7FFFF),
(Hue::Cyan, false) => (0x03A7D733, 0x089DD0FF, 0x014975FF),
(Hue::Cyan, true) => (0x03A7D733, 0x0171A4FF, 0xA1EEF9FF),
(Hue::Gray, false) => (0x0A131722, 0x647685FF, 0x0A1317FF),
(Hue::Gray, true) => (0x666A724C, 0x748695FF, 0xE7EAEDFF),
(Hue::Green, false) => (0x24BB5E33, 0x0D8626FF, 0x09441FFF),
(Hue::Green, true) => (0x24BB5E33, 0x0B991FFF, 0xA5F690FF),
(Hue::Orange, false) => (0xF2790233, 0xEB6E00FF, 0x6B2203FF),
(Hue::Orange, true) => (0xF2790233, 0xB34A01FF, 0xFDB876FF),
(Hue::Pink, false) => (0xE638B333, 0xF351C0FF, 0x650053FF),
(Hue::Pink, true) => (0xE638B333, 0xC02294FF, 0xFEADE3FF),
(Hue::Purple, false) => (0x7952FF33, 0x9081FFFF, 0x3E0697FF),
(Hue::Purple, true) => (0x7952FF33, 0x7340FEFF, 0xB3B0FEFF),
(Hue::Red, false) => (0xE3193B33, 0xE3193BFF, 0x7B0210FF),
(Hue::Red, true) => (0xE3193B33, 0xF5394FFF, 0xFFB2B8FF),
(Hue::Teal, false) => (0x0DB7AF33, 0x08A3A3FF, 0x083943FF),
(Hue::Teal, true) => (0x0DB7AF33, 0x08767DFF, 0x40DCCDFF),
(Hue::Yellow, false) => (0xE2A40033, 0xC58600FF, 0x753F07FF),
(Hue::Yellow, true) => (0xE2A40033, 0xB47700FF, 0xFBCE03FF),
};
HueColors {
background: rgba(bg).into(),
border: rgba(border).into(),
text: rgba(text).into(),
}
}
}
pub fn inset_ring(color: Hsla, width: Pixels) -> BoxShadow {
BoxShadow {
offset: point(px(0.0), px(0.0)),
blur_radius: px(0.0),
spread_radius: width,
inset: true,
color,
}
}
pub fn focus_ring(color: Hsla) -> BoxShadow {
inset_ring(color.opacity(0.5), px(2.0))
}
pub fn input_hover_ring(border: Hsla) -> BoxShadow {
inset_ring(border.opacity(0.30), px(2.0))
}
pub fn focus_ring_outer(color: Hsla) -> BoxShadow {
BoxShadow {
offset: point(px(0.0), px(0.0)),
blur_radius: px(0.0),
spread_radius: px(3.0),
inset: false,
color: color.opacity(0.4),
}
}
pub fn overlay_hover(dark: bool) -> Hsla {
if dark {
hsla(0.0, 0.0, 1.0, 0.05)
} else {
hsla(0.0, 0.0, 0.0, 0.05)
}
}
pub fn overlay_pressed(dark: bool) -> Hsla {
if dark {
hsla(0.0, 0.0, 1.0, 0.10)
} else {
hsla(0.0, 0.0, 0.0, 0.10)
}
}
pub fn status_muted(color: Hsla) -> Hsla {
color.opacity(0.16)
}