Merge branch 'KoffeinFlummi-theming' into develop
This commit is contained in:
@@ -4,7 +4,7 @@ use std::time::{Duration, SystemTime};
|
||||
use cursive::align::HAlign;
|
||||
use cursive::direction::Direction;
|
||||
use cursive::event::{AnyCb, Event, EventResult};
|
||||
use cursive::theme::ColorStyle;
|
||||
use cursive::theme::{ColorStyle, ColorType, Theme};
|
||||
use cursive::traits::View;
|
||||
use cursive::vec::Vec2;
|
||||
use cursive::view::{IntoBoxedView, Selector};
|
||||
@@ -30,21 +30,28 @@ pub struct Layout {
|
||||
error_time: Option<SystemTime>,
|
||||
screenchange: bool,
|
||||
ev: events::EventManager,
|
||||
theme: Theme,
|
||||
}
|
||||
|
||||
impl Layout {
|
||||
pub fn new<T: IntoBoxedView>(status: T, ev: &events::EventManager) -> Layout {
|
||||
pub fn new<T: IntoBoxedView>(status: T, ev: &events::EventManager, theme: Theme) -> Layout {
|
||||
let style = ColorStyle::new(
|
||||
ColorType::Color(*theme.palette.custom("cmdline_bg").unwrap()),
|
||||
ColorType::Color(*theme.palette.custom("cmdline").unwrap()),
|
||||
);
|
||||
|
||||
Layout {
|
||||
views: HashMap::new(),
|
||||
title: String::new(),
|
||||
statusbar: status.as_boxed_view(),
|
||||
focus: None,
|
||||
cmdline: EditView::new().filler(" "),
|
||||
cmdline: EditView::new().filler(" ").style(style),
|
||||
cmdline_focus: false,
|
||||
error: None,
|
||||
error_time: None,
|
||||
ev: ev.clone(),
|
||||
screenchange: true,
|
||||
theme: theme,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +142,11 @@ impl View for Layout {
|
||||
.draw(&printer.offset((0, printer.size.y - 2 - cmdline_height)));
|
||||
|
||||
if let Some(e) = error {
|
||||
printer.with_color(ColorStyle::highlight(), |printer| {
|
||||
let style = ColorStyle::new(
|
||||
ColorType::Color(*self.theme.palette.custom("error").unwrap()),
|
||||
ColorType::Color(*self.theme.palette.custom("error_bg").unwrap()),
|
||||
);
|
||||
printer.with_color(style, |printer| {
|
||||
printer.print_hline((0, printer.size.y - cmdline_height), printer.size.x, " ");
|
||||
printer.print(
|
||||
(0, printer.size.y - cmdline_height),
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::sync::{Arc, RwLock};
|
||||
|
||||
use cursive::align::HAlign;
|
||||
use cursive::event::{Event, EventResult, MouseButton, MouseEvent};
|
||||
use cursive::theme::ColorStyle;
|
||||
use cursive::theme::{ColorStyle, ColorType, PaletteColor};
|
||||
use cursive::traits::View;
|
||||
use cursive::view::ScrollBase;
|
||||
use cursive::{Printer, Rect, Vec2};
|
||||
@@ -64,9 +64,15 @@ impl<I: ListItem> View for ListView<I> {
|
||||
let item = &content[i];
|
||||
|
||||
let style = if self.selected == i {
|
||||
ColorStyle::highlight()
|
||||
ColorStyle::new(
|
||||
ColorType::Palette(PaletteColor::Tertiary),
|
||||
ColorType::Palette(PaletteColor::Highlight),
|
||||
)
|
||||
} else if item.is_playing(self.queue.clone()) {
|
||||
ColorStyle::secondary()
|
||||
ColorStyle::new(
|
||||
ColorType::Color(*printer.theme.palette.custom("playing").unwrap()),
|
||||
ColorType::Color(*printer.theme.palette.custom("playing_bg").unwrap()),
|
||||
)
|
||||
} else {
|
||||
ColorStyle::primary()
|
||||
};
|
||||
@@ -76,6 +82,7 @@ impl<I: ListItem> View for ListView<I> {
|
||||
|
||||
// draw left string
|
||||
printer.with_color(style, |printer| {
|
||||
printer.print_hline((0, 0), printer.size.x, " ");
|
||||
printer.print((0, 0), &left);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use cursive::align::HAlign;
|
||||
use cursive::theme::ColorStyle;
|
||||
use cursive::theme::{ColorStyle, ColorType, PaletteColor};
|
||||
use cursive::traits::View;
|
||||
use cursive::vec::Vec2;
|
||||
use cursive::Printer;
|
||||
@@ -30,8 +30,14 @@ impl View for StatusBar {
|
||||
return;
|
||||
}
|
||||
|
||||
let style_bar = ColorStyle::secondary();
|
||||
let style = ColorStyle::title_secondary();
|
||||
let style_bar = ColorStyle::new(
|
||||
ColorType::Color(*printer.theme.palette.custom("statusbar_progress").unwrap()),
|
||||
ColorType::Palette(PaletteColor::Background),
|
||||
);
|
||||
let style = ColorStyle::new(
|
||||
ColorType::Color(*printer.theme.palette.custom("statusbar").unwrap()),
|
||||
ColorType::Color(*printer.theme.palette.custom("statusbar_bg").unwrap()),
|
||||
);
|
||||
|
||||
printer.print(
|
||||
(0, 0),
|
||||
|
||||
Reference in New Issue
Block a user