- Extract editor, form, export, and schema modules - Add database workflow integration tests
80 lines
2.4 KiB
Rust
80 lines
2.4 KiB
Rust
use ratatui::style::Color;
|
|
|
|
#[derive(Clone, Copy)]
|
|
pub(super) struct Palette {
|
|
pub primary: Color,
|
|
pub accent: Color,
|
|
pub canvas: Color,
|
|
pub canvas_heading: Color,
|
|
pub selection: Color,
|
|
pub selection_foreground: Color,
|
|
pub foreground: Color,
|
|
}
|
|
|
|
pub(super) fn palette(theme: &str) -> Palette {
|
|
match theme {
|
|
"mono" => Palette {
|
|
primary: Color::Black,
|
|
accent: Color::White,
|
|
canvas: Color::Gray,
|
|
canvas_heading: Color::Black,
|
|
selection: Color::DarkGray,
|
|
selection_foreground: rgb(0xffffff),
|
|
foreground: Color::Black,
|
|
},
|
|
"amber" => Palette {
|
|
primary: Color::Black,
|
|
accent: Color::Rgb(255, 191, 0),
|
|
canvas: Color::Rgb(32, 24, 0),
|
|
canvas_heading: Color::Rgb(255, 191, 0),
|
|
selection: Color::Rgb(112, 56, 0),
|
|
selection_foreground: rgb(0xffffff),
|
|
foreground: Color::Rgb(255, 191, 0),
|
|
},
|
|
"greenscreen" => Palette {
|
|
primary: Color::Black,
|
|
accent: rgb(0x79a86b),
|
|
canvas: rgb(0x030704),
|
|
canvas_heading: rgb(0x9ac58d),
|
|
selection: rgb(0x284b2f),
|
|
selection_foreground: rgb(0xdce8d8),
|
|
foreground: rgb(0x8fbd80),
|
|
},
|
|
"nord" => Palette {
|
|
primary: rgb(0x2e3440),
|
|
accent: rgb(0x88c0d0),
|
|
canvas: rgb(0x3b4252),
|
|
canvas_heading: rgb(0xeceff4),
|
|
selection: rgb(0xeceff4),
|
|
selection_foreground: rgb(0x2e3440),
|
|
foreground: rgb(0xeceff4),
|
|
},
|
|
"catppuccin-mocha" => Palette {
|
|
primary: rgb(0x181825),
|
|
accent: rgb(0xcba6f7),
|
|
canvas: rgb(0x1e1e2e),
|
|
canvas_heading: rgb(0xcdd6f4),
|
|
selection: rgb(0xcba6f7),
|
|
selection_foreground: rgb(0x11111b),
|
|
foreground: rgb(0xcdd6f4),
|
|
},
|
|
_ => Palette {
|
|
primary: Color::Rgb(0, 0, 128),
|
|
accent: Color::Cyan,
|
|
canvas: Color::Rgb(192, 192, 192),
|
|
canvas_heading: Color::Rgb(0, 0, 128),
|
|
selection: Color::Rgb(128, 0, 0),
|
|
selection_foreground: rgb(0xffffff),
|
|
foreground: Color::Black,
|
|
},
|
|
}
|
|
}
|
|
|
|
pub(super) const fn rgb(value: u32) -> Color {
|
|
Color::Rgb(
|
|
((value >> 16) & 0xff) as u8,
|
|
((value >> 8) & 0xff) as u8,
|
|
(value & 0xff) as u8,
|
|
)
|
|
}
|