mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-16 00:16:41 +01:00
src -> app; move core libs to tengri
This commit is contained in:
parent
8465d64807
commit
bcc3f5809e
113 changed files with 132 additions and 5729 deletions
22
app/src/view_color.rs
Normal file
22
app/src/view_color.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
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 }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue