Fixing color schemes
This commit is contained in:
@@ -5,7 +5,7 @@ use ratatui::Frame;
|
||||
|
||||
use crate::app::App;
|
||||
use crate::engine::SequencerSnapshot;
|
||||
use crate::theme::{meter, selection, tile, ui};
|
||||
use crate::theme;
|
||||
use crate::widgets::{Orientation, Scope, Spectrum, VuMeter};
|
||||
|
||||
pub fn render(frame: &mut Frame, app: &App, snapshot: &SequencerSnapshot, area: Rect) {
|
||||
@@ -65,10 +65,12 @@ pub fn render(frame: &mut Frame, app: &App, snapshot: &SequencerSnapshot, area:
|
||||
const STEPS_PER_PAGE: usize = 32;
|
||||
|
||||
fn render_sequencer(frame: &mut Frame, app: &App, snapshot: &SequencerSnapshot, area: Rect) {
|
||||
let theme = theme::get();
|
||||
|
||||
if area.width < 50 {
|
||||
let msg = Paragraph::new("Terminal too narrow")
|
||||
.alignment(Alignment::Center)
|
||||
.style(Style::new().fg(ui::TEXT_MUTED));
|
||||
.style(Style::new().fg(theme.ui.text_muted));
|
||||
frame.render_widget(msg, area);
|
||||
return;
|
||||
}
|
||||
@@ -132,6 +134,7 @@ fn render_tile(
|
||||
snapshot: &SequencerSnapshot,
|
||||
step_idx: usize,
|
||||
) {
|
||||
let theme = theme::get();
|
||||
let pattern = app.current_edit_pattern();
|
||||
let step = pattern.step(step_idx);
|
||||
let is_active = step.map(|s| s.active).unwrap_or(false);
|
||||
@@ -149,26 +152,26 @@ fn render_tile(
|
||||
|
||||
let link_color = step.and_then(|s| s.source).map(|src| {
|
||||
let i = src % 5;
|
||||
(tile::LINK_BRIGHT[i], tile::LINK_DIM[i])
|
||||
(theme.tile.link_bright[i], theme.tile.link_dim[i])
|
||||
});
|
||||
|
||||
let (bg, fg) = match (is_playing, is_active, is_selected, is_linked, in_selection) {
|
||||
(true, true, _, _, _) => (tile::PLAYING_ACTIVE_BG, tile::PLAYING_ACTIVE_FG),
|
||||
(true, false, _, _, _) => (tile::PLAYING_INACTIVE_BG, tile::PLAYING_INACTIVE_FG),
|
||||
(true, true, _, _, _) => (theme.tile.playing_active_bg, theme.tile.playing_active_fg),
|
||||
(true, false, _, _, _) => (theme.tile.playing_inactive_bg, theme.tile.playing_inactive_fg),
|
||||
(false, true, true, true, _) => {
|
||||
let (r, g, b) = link_color.unwrap().0;
|
||||
(Color::Rgb(r, g, b), selection::CURSOR_FG)
|
||||
(Color::Rgb(r, g, b), theme.selection.cursor_fg)
|
||||
}
|
||||
(false, true, true, false, _) => (tile::ACTIVE_SELECTED_BG, selection::CURSOR_FG),
|
||||
(false, true, _, _, true) => (tile::ACTIVE_IN_RANGE_BG, selection::CURSOR_FG),
|
||||
(false, true, true, false, _) => (theme.tile.active_selected_bg, theme.selection.cursor_fg),
|
||||
(false, true, _, _, true) => (theme.tile.active_in_range_bg, theme.selection.cursor_fg),
|
||||
(false, true, false, true, _) => {
|
||||
let (r, g, b) = link_color.unwrap().1;
|
||||
(Color::Rgb(r, g, b), tile::ACTIVE_FG)
|
||||
(Color::Rgb(r, g, b), theme.tile.active_fg)
|
||||
}
|
||||
(false, true, false, false, _) => (tile::ACTIVE_BG, tile::ACTIVE_FG),
|
||||
(false, false, true, _, _) => (selection::SELECTED, selection::CURSOR_FG),
|
||||
(false, false, _, _, true) => (selection::IN_RANGE, selection::CURSOR_FG),
|
||||
(false, false, false, _, _) => (tile::INACTIVE_BG, tile::INACTIVE_FG),
|
||||
(false, true, false, false, _) => (theme.tile.active_bg, theme.tile.active_fg),
|
||||
(false, false, true, _, _) => (theme.selection.selected, theme.selection.cursor_fg),
|
||||
(false, false, _, _, true) => (theme.selection.in_range, theme.selection.cursor_fg),
|
||||
(false, false, false, _, _) => (theme.tile.inactive_bg, theme.tile.inactive_fg),
|
||||
};
|
||||
|
||||
let source_idx = step.and_then(|s| s.source);
|
||||
@@ -231,9 +234,10 @@ fn render_tile(
|
||||
}
|
||||
|
||||
fn render_scope(frame: &mut Frame, app: &App, area: Rect) {
|
||||
let theme = theme::get();
|
||||
let scope = Scope::new(&app.metrics.scope)
|
||||
.orientation(Orientation::Horizontal)
|
||||
.color(meter::LOW);
|
||||
.color(theme.meter.low);
|
||||
frame.render_widget(scope, area);
|
||||
}
|
||||
|
||||
@@ -247,4 +251,3 @@ fn render_vu_meter(frame: &mut Frame, app: &App, area: Rect) {
|
||||
let vu = VuMeter::new(app.metrics.peak_left, app.metrics.peak_right);
|
||||
frame.render_widget(vu, area);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user