mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
144 lines
3.4 KiB
Rust
144 lines
3.4 KiB
Rust
use crate::*;
|
|
use ratatui::style::Modifier;
|
|
|
|
pub trait Theme {
|
|
const BG0: Color;
|
|
const BG1: Color;
|
|
const BG2: Color;
|
|
const BG3: Color;
|
|
const BG4: Color;
|
|
const RED: Color;
|
|
const YELLOW: Color;
|
|
const GREEN: Color;
|
|
|
|
const PLAYING: Color;
|
|
const SEPARATOR: Color;
|
|
|
|
fn bg_hier (focused: bool, entered: bool) -> Color {
|
|
if focused && entered {
|
|
Self::BG3
|
|
} else if focused {
|
|
Self::BG2
|
|
} else {
|
|
Self::BG1
|
|
}
|
|
}
|
|
|
|
fn bg_hi (focused: bool, entered: bool) -> Color {
|
|
if focused && entered {
|
|
Self::BG2
|
|
} else if focused {
|
|
Self::BG1
|
|
} else {
|
|
Self::BG0
|
|
}
|
|
}
|
|
|
|
fn bg_lo (focused: bool, entered: bool) -> Color {
|
|
if focused && entered {
|
|
Self::BG1
|
|
} else if focused {
|
|
Self::BG0
|
|
} else {
|
|
Color::Reset
|
|
}
|
|
}
|
|
|
|
fn style_hi (focused: bool, highlight: bool) -> Style {
|
|
if highlight && focused {
|
|
Style::default().yellow().not_dim()
|
|
} else if highlight {
|
|
Style::default().yellow().dim()
|
|
} else {
|
|
Style::default()
|
|
}
|
|
}
|
|
}
|
|
|
|
pub struct Nord;
|
|
|
|
impl Theme for Nord {
|
|
const BG0: Color = Color::Rgb(41, 46, 57);
|
|
const BG1: Color = Color::Rgb(46, 52, 64);
|
|
const BG2: Color = Color::Rgb(59, 66, 82);
|
|
const BG3: Color = Color::Rgb(67, 76, 94);
|
|
const BG4: Color = Color::Rgb(76, 86, 106);
|
|
const RED: Color = Color::Rgb(191, 97, 106);
|
|
const YELLOW: Color = Color::Rgb(235, 203, 139);
|
|
const GREEN: Color = Color::Rgb(163, 190, 140);
|
|
|
|
const PLAYING: Color = Color::Rgb(60, 100, 50);
|
|
const SEPARATOR: Color = Color::Rgb(0, 0, 0);
|
|
}
|
|
|
|
pub const GRAY: Style = Style {
|
|
fg: Some(Color::Gray),
|
|
bg: None,
|
|
underline_color: None,
|
|
add_modifier: Modifier::empty(),
|
|
sub_modifier: Modifier::empty(),
|
|
};
|
|
|
|
pub const GRAY_NOT_DIM: Style = Style {
|
|
fg: Some(Color::Gray),
|
|
bg: None,
|
|
underline_color: None,
|
|
add_modifier: Modifier::empty(),
|
|
sub_modifier: Modifier::DIM,
|
|
};
|
|
|
|
pub const DIM: Style = Style {
|
|
fg: None,
|
|
bg: None,
|
|
underline_color: None,
|
|
add_modifier: Modifier::DIM,
|
|
sub_modifier: Modifier::empty(),
|
|
};
|
|
|
|
pub const GRAY_DIM: Style = Style {
|
|
fg: Some(Color::Gray),
|
|
bg: None,
|
|
underline_color: None,
|
|
add_modifier: Modifier::DIM,
|
|
sub_modifier: Modifier::empty(),
|
|
};
|
|
|
|
pub const WHITE_NOT_DIM_BOLD: Style = Style {
|
|
fg: Some(Color::White),
|
|
bg: None,
|
|
underline_color: None,
|
|
add_modifier: Modifier::BOLD,
|
|
sub_modifier: Modifier::DIM,
|
|
};
|
|
|
|
pub const GRAY_NOT_DIM_BOLD: Style = Style {
|
|
fg: Some(Color::Gray),
|
|
bg: None,
|
|
underline_color: None,
|
|
add_modifier: Modifier::BOLD,
|
|
sub_modifier: Modifier::DIM,
|
|
};
|
|
|
|
pub const NOT_DIM: Style = Style {
|
|
fg: None,
|
|
bg: None,
|
|
underline_color: None,
|
|
add_modifier: Modifier::empty(),
|
|
sub_modifier: Modifier::DIM,
|
|
};
|
|
|
|
pub const NOT_DIM_GREEN: Style = Style {
|
|
fg: Some(Color::Green),
|
|
bg: None,
|
|
underline_color: None,
|
|
add_modifier: Modifier::BOLD,
|
|
sub_modifier: Modifier::DIM,
|
|
};
|
|
|
|
pub const NOT_DIM_BOLD: Style = Style {
|
|
fg: None,
|
|
bg: None,
|
|
underline_color: None,
|
|
add_modifier: Modifier::BOLD,
|
|
sub_modifier: Modifier::DIM,
|
|
};
|