mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-13 07:06:41 +01:00
22 lines
834 B
Rust
22 lines
834 B
Rust
use crate::*;
|
|
impl Tek {
|
|
pub(crate) fn colors (
|
|
theme: &ItemPalette,
|
|
prev: Option<ItemPalette>,
|
|
selected: bool,
|
|
neighbor: bool,
|
|
is_last: bool,
|
|
) -> [Color;4] {
|
|
let fg = theme.lightest.rgb;
|
|
let bg = if selected { theme.light } else { theme.base }.rgb;
|
|
let hi = Self::color_hi(prev, neighbor);
|
|
let lo = Self::color_lo(theme, is_last, selected);
|
|
[fg, bg, hi, lo]
|
|
}
|
|
pub(crate) fn color_hi (prev: Option<ItemPalette>, neighbor: bool) -> Color {
|
|
prev.map(|prev|if neighbor { prev.light.rgb } else { prev.base.rgb }).unwrap_or(Reset)
|
|
}
|
|
pub(crate) fn color_lo (theme: &ItemPalette, is_last: bool, selected: bool) -> Color {
|
|
if is_last { Reset } else if selected { theme.light.rgb } else { theme.base.rgb }
|
|
}
|
|
}
|