Fix: align with color palette of Cursive

Should make context menus (`SelectView`) look like ncspot's `ListView`.

Fixes #431
This commit is contained in:
Henrik Friedrichsen
2022-08-20 23:40:33 +02:00
parent 966223392e
commit a9f7f3cddc
3 changed files with 10 additions and 14 deletions

View File

@@ -31,7 +31,7 @@ pub fn load(theme_cfg: &Option<ConfigTheme>) -> Theme {
palette[Primary] = load_color!(theme_cfg, primary, TerminalDefault); palette[Primary] = load_color!(theme_cfg, primary, TerminalDefault);
palette[Secondary] = load_color!(theme_cfg, secondary, Dark(Blue)); palette[Secondary] = load_color!(theme_cfg, secondary, Dark(Blue));
palette[TitlePrimary] = load_color!(theme_cfg, title, Dark(Red)); palette[TitlePrimary] = load_color!(theme_cfg, title, Dark(Red));
palette[Tertiary] = load_color!(theme_cfg, highlight, TerminalDefault); palette[HighlightText] = load_color!(theme_cfg, highlight, Dark(White));
palette[Highlight] = load_color!(theme_cfg, highlight_bg, Dark(Red)); palette[Highlight] = load_color!(theme_cfg, highlight_bg, Dark(Red));
palette.set_color("playing", load_color!(theme_cfg, playing, Dark(Blue))); palette.set_color("playing", load_color!(theme_cfg, playing, Dark(Blue)));
palette.set_color( palette.set_color(

View File

@@ -176,15 +176,14 @@ impl<I: ListItem> View for ListView<I> {
&& self.queue.get_current_index() == Some(i); && self.queue.get_current_index() == Some(i);
let style = if self.selected == i { let style = if self.selected == i {
let fg = if currently_playing { if currently_playing {
*printer.theme.palette.custom("playing_selected").unwrap() ColorStyle::new(
*printer.theme.palette.custom("playing_selected").unwrap(),
ColorType::Palette(PaletteColor::Highlight),
)
} else { } else {
PaletteColor::Tertiary.resolve(&printer.theme.palette) ColorStyle::highlight()
}; }
ColorStyle::new(
ColorType::Color(fg),
ColorType::Palette(PaletteColor::Highlight),
)
} else if currently_playing { } else if currently_playing {
ColorStyle::new( ColorStyle::new(
ColorType::Color(*printer.theme.palette.custom("playing").unwrap()), ColorType::Color(*printer.theme.palette.custom("playing").unwrap()),

View File

@@ -3,7 +3,7 @@ use std::collections::HashMap;
use cursive::align::HAlign; use cursive::align::HAlign;
use cursive::event::{Event, EventResult, MouseButton, MouseEvent}; use cursive::event::{Event, EventResult, MouseButton, MouseEvent};
use cursive::theme::{ColorStyle, ColorType, PaletteColor}; use cursive::theme::ColorStyle;
use cursive::traits::View; use cursive::traits::View;
use cursive::{Cursive, Printer, Vec2}; use cursive::{Cursive, Printer, Vec2};
use unicode_width::UnicodeWidthStr; use unicode_width::UnicodeWidthStr;
@@ -66,10 +66,7 @@ impl View for TabView {
let tabwidth = printer.size.x / self.tabs.len(); let tabwidth = printer.size.x / self.tabs.len();
for (i, tab) in self.tabs.iter().enumerate() { for (i, tab) in self.tabs.iter().enumerate() {
let style = if self.selected == i { let style = if self.selected == i {
ColorStyle::new( ColorStyle::highlight()
ColorType::Palette(PaletteColor::Tertiary),
ColorType::Palette(PaletteColor::Highlight),
)
} else { } else {
ColorStyle::primary() ColorStyle::primary()
}; };