Reworked statistics
This commit is contained in:
+55
-2
@@ -1,12 +1,19 @@
|
||||
use ratatui::style::{Color, Modifier, Style};
|
||||
|
||||
use crate::app::state::{AppState, DevicePlaybackRole};
|
||||
|
||||
pub const ACCENT: Color = Color::Cyan;
|
||||
pub const CONTROL_ACCENT: Color = Color::Yellow;
|
||||
pub const DIM: Color = Color::DarkGray;
|
||||
|
||||
pub fn accent() -> Style {
|
||||
Style::new().fg(ACCENT)
|
||||
}
|
||||
|
||||
pub fn accent_for(state: &AppState) -> Style {
|
||||
Style::new().fg(accent_color_for(state))
|
||||
}
|
||||
|
||||
pub fn dim() -> Style {
|
||||
Style::new().fg(DIM)
|
||||
}
|
||||
@@ -18,6 +25,13 @@ pub fn tab_active() -> Style {
|
||||
.add_modifier(Modifier::BOLD)
|
||||
}
|
||||
|
||||
pub fn tab_active_for(state: &AppState) -> Style {
|
||||
Style::new()
|
||||
.fg(Color::Black)
|
||||
.bg(accent_color_for(state))
|
||||
.add_modifier(Modifier::BOLD)
|
||||
}
|
||||
|
||||
pub fn danger_button() -> Style {
|
||||
Style::new()
|
||||
.fg(Color::White)
|
||||
@@ -29,6 +43,45 @@ pub fn selection() -> Style {
|
||||
Style::new().fg(Color::White).bg(Color::Rgb(24, 68, 72))
|
||||
}
|
||||
|
||||
pub fn header() -> Style {
|
||||
Style::new().fg(ACCENT).add_modifier(Modifier::BOLD)
|
||||
pub fn selection_for(state: &AppState) -> Style {
|
||||
if state.device_playback.is_control() {
|
||||
Style::new().fg(Color::White).bg(Color::Rgb(92, 72, 0))
|
||||
} else {
|
||||
selection()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn header_for(state: &AppState) -> Style {
|
||||
accent_for(state).add_modifier(Modifier::BOLD)
|
||||
}
|
||||
|
||||
pub fn border_for(state: &AppState) -> Style {
|
||||
if state.device_playback.is_control() {
|
||||
Style::new().fg(CONTROL_ACCENT)
|
||||
} else {
|
||||
dim()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn strong_border_for(state: &AppState) -> Style {
|
||||
accent_for(state)
|
||||
}
|
||||
|
||||
pub fn role_pill(role: DevicePlaybackRole) -> Style {
|
||||
let bg = match role {
|
||||
DevicePlaybackRole::Active => Color::Green,
|
||||
DevicePlaybackRole::Control => CONTROL_ACCENT,
|
||||
};
|
||||
Style::new()
|
||||
.fg(Color::Black)
|
||||
.bg(bg)
|
||||
.add_modifier(Modifier::BOLD)
|
||||
}
|
||||
|
||||
fn accent_color_for(state: &AppState) -> Color {
|
||||
if state.device_playback.is_control() {
|
||||
CONTROL_ACCENT
|
||||
} else {
|
||||
ACCENT
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user