2026-04-20 15:13:26 +01:00
|
|
|
use gpui::Rgba;
|
|
|
|
|
|
|
|
|
|
pub const fn hex(hex: u32) -> Rgba {
|
|
|
|
|
let [_, r, g, b] = hex.to_be_bytes();
|
|
|
|
|
|
|
|
|
|
Rgba {
|
|
|
|
|
r: r as f32 / 255.0,
|
|
|
|
|
g: g as f32 / 255.0,
|
|
|
|
|
b: b as f32 / 255.0,
|
|
|
|
|
a: 1.0,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-13 20:02:26 +08:00
|
|
|
pub const fn hex_alpha(hex: u32, alpha: f32) -> Rgba {
|
|
|
|
|
let [_, r, g, b] = hex.to_be_bytes();
|
|
|
|
|
|
|
|
|
|
Rgba {
|
|
|
|
|
r: r as f32 / 255.0,
|
|
|
|
|
g: g as f32 / 255.0,
|
|
|
|
|
b: b as f32 / 255.0,
|
|
|
|
|
a: alpha,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-26 00:46:11 +01:00
|
|
|
#[allow(dead_code)]
|
2026-04-20 15:13:26 +01:00
|
|
|
pub const fn neutral(shade: u16) -> Rgba {
|
|
|
|
|
match shade {
|
2026-05-13 20:02:26 +08:00
|
|
|
| 50 => hex(0xfafafa),
|
|
|
|
|
| 100 => hex(0xf5f5f5),
|
|
|
|
|
| 200 => hex(0xe5e5e5),
|
|
|
|
|
| 300 => hex(0xd4d4d4),
|
|
|
|
|
| 400 => hex(0xa3a3a3),
|
|
|
|
|
| 500 => hex(0x737373),
|
|
|
|
|
| 600 => hex(0x525252),
|
|
|
|
|
| 700 => hex(0x404040),
|
|
|
|
|
| 800 => hex(0x262626),
|
|
|
|
|
| 900 => hex(0x171717),
|
|
|
|
|
| 950 => hex(0x0a0a0a),
|
|
|
|
|
| _ => panic!("unsupported Tailwind neutral shade"),
|
2026-04-20 15:13:26 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-26 00:46:11 +01:00
|
|
|
#[allow(dead_code)]
|
2026-04-20 15:13:26 +01:00
|
|
|
pub const fn violet(shade: u16) -> Rgba {
|
|
|
|
|
match shade {
|
2026-05-13 20:02:26 +08:00
|
|
|
| 50 => hex(0xf5f3ff),
|
|
|
|
|
| 100 => hex(0xede9fe),
|
|
|
|
|
| 200 => hex(0xddd6fe),
|
|
|
|
|
| 300 => hex(0xc4b5fd),
|
|
|
|
|
| 400 => hex(0xa78bfa),
|
|
|
|
|
| 500 => hex(0x8b5cf6),
|
|
|
|
|
| 600 => hex(0x7c3aed),
|
|
|
|
|
| 700 => hex(0x6d28d9),
|
|
|
|
|
| 800 => hex(0x5b21b6),
|
|
|
|
|
| 900 => hex(0x4c1d95),
|
|
|
|
|
| 950 => hex(0x2e1065),
|
|
|
|
|
| _ => panic!("unsupported Tailwind violet shade"),
|
2026-04-20 15:13:26 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-26 00:46:11 +01:00
|
|
|
#[allow(dead_code)]
|
2026-04-20 15:13:26 +01:00
|
|
|
pub const fn amber(shade: u16) -> Rgba {
|
|
|
|
|
match shade {
|
2026-05-13 20:02:26 +08:00
|
|
|
| 50 => hex(0xfffbeb),
|
|
|
|
|
| 100 => hex(0xfef3c7),
|
|
|
|
|
| 200 => hex(0xfde68a),
|
|
|
|
|
| 300 => hex(0xfcd34d),
|
|
|
|
|
| 400 => hex(0xfbbf24),
|
|
|
|
|
| 500 => hex(0xf59e0b),
|
|
|
|
|
| 600 => hex(0xd97706),
|
|
|
|
|
| 700 => hex(0xb45309),
|
|
|
|
|
| 800 => hex(0x92400e),
|
|
|
|
|
| 900 => hex(0x78350f),
|
|
|
|
|
| 950 => hex(0x451a03),
|
|
|
|
|
| _ => panic!("unsupported Tailwind amber shade"),
|
2026-04-20 15:13:26 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-26 00:46:11 +01:00
|
|
|
#[allow(dead_code)]
|
2026-04-20 15:13:26 +01:00
|
|
|
pub const fn red(shade: u16) -> Rgba {
|
|
|
|
|
match shade {
|
2026-05-13 20:02:26 +08:00
|
|
|
| 50 => hex(0xfef2f2),
|
|
|
|
|
| 100 => hex(0xfee2e2),
|
|
|
|
|
| 200 => hex(0xfecaca),
|
|
|
|
|
| 300 => hex(0xfca5a5),
|
|
|
|
|
| 400 => hex(0xf87171),
|
|
|
|
|
| 500 => hex(0xef4444),
|
|
|
|
|
| 600 => hex(0xdc2626),
|
|
|
|
|
| 700 => hex(0xb91c1c),
|
|
|
|
|
| 800 => hex(0x991b1b),
|
|
|
|
|
| 900 => hex(0x7f1d1d),
|
|
|
|
|
| 950 => hex(0x450a0a),
|
|
|
|
|
| _ => panic!("unsupported Tailwind red shade"),
|
2026-04-20 15:13:26 +01:00
|
|
|
}
|
|
|
|
|
}
|