Fixing color schemes
This commit is contained in:
@@ -7,7 +7,7 @@ use ratatui::Frame;
|
||||
|
||||
use crate::app::App;
|
||||
use crate::state::{DeviceKind, EngineSection, SettingKind};
|
||||
use crate::theme::{engine, meter};
|
||||
use crate::theme;
|
||||
use crate::widgets::{Orientation, Scope, Spectrum};
|
||||
|
||||
pub fn render(frame: &mut Frame, app: &App, area: Rect) {
|
||||
@@ -23,10 +23,11 @@ pub fn render(frame: &mut Frame, app: &App, area: Rect) {
|
||||
}
|
||||
|
||||
fn render_settings_section(frame: &mut Frame, app: &App, area: Rect) {
|
||||
let theme = theme::get();
|
||||
let block = Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.title(" Engine ")
|
||||
.border_style(Style::new().fg(engine::BORDER_MAGENTA));
|
||||
.border_style(Style::new().fg(theme.engine.border_magenta));
|
||||
|
||||
let inner = block.inner(area);
|
||||
frame.render_widget(block, area);
|
||||
@@ -122,7 +123,7 @@ fn render_settings_section(frame: &mut Frame, app: &App, area: Rect) {
|
||||
}
|
||||
|
||||
// Scroll indicators
|
||||
let indicator_style = Style::new().fg(engine::SCROLL_INDICATOR);
|
||||
let indicator_style = Style::new().fg(theme.engine.scroll_indicator);
|
||||
let indicator_x = padded.x + padded.width.saturating_sub(1);
|
||||
|
||||
if scroll_offset > 0 {
|
||||
@@ -152,25 +153,27 @@ fn render_visualizers(frame: &mut Frame, app: &App, area: Rect) {
|
||||
}
|
||||
|
||||
fn render_scope(frame: &mut Frame, app: &App, area: Rect) {
|
||||
let theme = theme::get();
|
||||
let block = Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.title(" Scope ")
|
||||
.border_style(Style::new().fg(engine::BORDER_GREEN));
|
||||
.border_style(Style::new().fg(theme.engine.border_green));
|
||||
|
||||
let inner = block.inner(area);
|
||||
frame.render_widget(block, area);
|
||||
|
||||
let scope = Scope::new(&app.metrics.scope)
|
||||
.orientation(Orientation::Horizontal)
|
||||
.color(meter::LOW);
|
||||
.color(theme.meter.low);
|
||||
frame.render_widget(scope, inner);
|
||||
}
|
||||
|
||||
fn render_spectrum(frame: &mut Frame, app: &App, area: Rect) {
|
||||
let theme = theme::get();
|
||||
let block = Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.title(" Spectrum ")
|
||||
.border_style(Style::new().fg(engine::BORDER_CYAN));
|
||||
.border_style(Style::new().fg(theme.engine.border_cyan));
|
||||
|
||||
let inner = block.inner(area);
|
||||
frame.render_widget(block, area);
|
||||
@@ -203,25 +206,27 @@ fn devices_section_height(app: &App) -> u16 {
|
||||
}
|
||||
|
||||
fn render_section_header(frame: &mut Frame, title: &str, focused: bool, area: Rect) {
|
||||
let theme = theme::get();
|
||||
let [header_area, divider_area] =
|
||||
Layout::vertical([Constraint::Length(1), Constraint::Length(1)]).areas(area);
|
||||
|
||||
let header_style = if focused {
|
||||
Style::new().fg(engine::HEADER_FOCUSED).add_modifier(Modifier::BOLD)
|
||||
Style::new().fg(theme.engine.header_focused).add_modifier(Modifier::BOLD)
|
||||
} else {
|
||||
Style::new().fg(engine::HEADER).add_modifier(Modifier::BOLD)
|
||||
Style::new().fg(theme.engine.header).add_modifier(Modifier::BOLD)
|
||||
};
|
||||
|
||||
frame.render_widget(Paragraph::new(title).style(header_style), header_area);
|
||||
|
||||
let divider = "─".repeat(area.width as usize);
|
||||
frame.render_widget(
|
||||
Paragraph::new(divider).style(Style::new().fg(engine::DIVIDER)),
|
||||
Paragraph::new(divider).style(Style::new().fg(theme.engine.divider)),
|
||||
divider_area,
|
||||
);
|
||||
}
|
||||
|
||||
fn render_devices(frame: &mut Frame, app: &App, area: Rect) {
|
||||
let theme = theme::get();
|
||||
let section_focused = app.audio.section == EngineSection::Devices;
|
||||
|
||||
let [header_area, content_area] =
|
||||
@@ -251,7 +256,7 @@ fn render_devices(frame: &mut Frame, app: &App, area: Rect) {
|
||||
section_focused,
|
||||
);
|
||||
|
||||
let sep_style = Style::new().fg(engine::SEPARATOR);
|
||||
let sep_style = Style::new().fg(theme.engine.separator);
|
||||
let sep_lines: Vec<Line> = (0..separator.height)
|
||||
.map(|_| Line::from(Span::styled("│", sep_style)))
|
||||
.collect();
|
||||
@@ -282,15 +287,16 @@ fn render_device_column(
|
||||
focused: bool,
|
||||
section_focused: bool,
|
||||
) {
|
||||
let theme = theme::get();
|
||||
let [label_area, list_area] =
|
||||
Layout::vertical([Constraint::Length(1), Constraint::Min(1)]).areas(area);
|
||||
|
||||
let label_style = if focused {
|
||||
Style::new().fg(engine::FOCUSED).add_modifier(Modifier::BOLD)
|
||||
Style::new().fg(theme.engine.focused).add_modifier(Modifier::BOLD)
|
||||
} else if section_focused {
|
||||
Style::new().fg(engine::LABEL_FOCUSED)
|
||||
Style::new().fg(theme.engine.label_focused)
|
||||
} else {
|
||||
Style::new().fg(engine::LABEL_DIM)
|
||||
Style::new().fg(theme.engine.label_dim)
|
||||
};
|
||||
|
||||
let arrow = if focused { "> " } else { " " };
|
||||
@@ -308,6 +314,7 @@ fn render_device_column(
|
||||
}
|
||||
|
||||
fn render_settings(frame: &mut Frame, app: &App, area: Rect) {
|
||||
let theme = theme::get();
|
||||
let section_focused = app.audio.section == EngineSection::Settings;
|
||||
|
||||
let [header_area, content_area] =
|
||||
@@ -315,10 +322,10 @@ fn render_settings(frame: &mut Frame, app: &App, area: Rect) {
|
||||
|
||||
render_section_header(frame, "SETTINGS", section_focused, header_area);
|
||||
|
||||
let highlight = Style::new().fg(engine::FOCUSED).add_modifier(Modifier::BOLD);
|
||||
let normal = Style::new().fg(engine::NORMAL);
|
||||
let label_style = Style::new().fg(engine::LABEL);
|
||||
let value_style = Style::new().fg(engine::VALUE);
|
||||
let highlight = Style::new().fg(theme.engine.focused).add_modifier(Modifier::BOLD);
|
||||
let normal = Style::new().fg(theme.engine.normal);
|
||||
let label_style = Style::new().fg(theme.engine.label);
|
||||
let value_style = Style::new().fg(theme.engine.value);
|
||||
|
||||
let channels_focused = section_focused && app.audio.setting_kind == SettingKind::Channels;
|
||||
let buffer_focused = section_focused && app.audio.setting_kind == SettingKind::BufferSize;
|
||||
@@ -420,6 +427,7 @@ fn render_settings(frame: &mut Frame, app: &App, area: Rect) {
|
||||
}
|
||||
|
||||
fn render_samples(frame: &mut Frame, app: &App, area: Rect) {
|
||||
let theme = theme::get();
|
||||
let section_focused = app.audio.section == EngineSection::Samples;
|
||||
|
||||
let [header_area, content_area, _, hint_area] = Layout::vertical([
|
||||
@@ -435,8 +443,8 @@ fn render_samples(frame: &mut Frame, app: &App, area: Rect) {
|
||||
let header_text = format!("SAMPLES {path_count} paths · {sample_count} indexed");
|
||||
render_section_header(frame, &header_text, section_focused, header_area);
|
||||
|
||||
let dim = Style::new().fg(engine::DIM);
|
||||
let path_style = Style::new().fg(engine::PATH);
|
||||
let dim = Style::new().fg(theme.engine.dim);
|
||||
let path_style = Style::new().fg(theme.engine.path);
|
||||
|
||||
let mut lines: Vec<Line> = Vec::new();
|
||||
if app.audio.config.sample_paths.is_empty() {
|
||||
@@ -467,15 +475,15 @@ fn render_samples(frame: &mut Frame, app: &App, area: Rect) {
|
||||
frame.render_widget(Paragraph::new(lines), content_area);
|
||||
|
||||
let hint_style = if section_focused {
|
||||
Style::new().fg(engine::HINT_ACTIVE)
|
||||
Style::new().fg(theme.engine.hint_active)
|
||||
} else {
|
||||
Style::new().fg(engine::HINT_INACTIVE)
|
||||
Style::new().fg(theme.engine.hint_inactive)
|
||||
};
|
||||
let hint = Line::from(vec![
|
||||
Span::styled("A", hint_style),
|
||||
Span::styled(":add ", Style::new().fg(engine::DIM)),
|
||||
Span::styled(":add ", Style::new().fg(theme.engine.dim)),
|
||||
Span::styled("D", hint_style),
|
||||
Span::styled(":remove", Style::new().fg(engine::DIM)),
|
||||
Span::styled(":remove", Style::new().fg(theme.engine.dim)),
|
||||
]);
|
||||
frame.render_widget(Paragraph::new(hint), hint_area);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user