Feat: documentation, UI/UX

This commit is contained in:
2026-03-01 19:09:52 +01:00
parent ecb559e556
commit db44f9b98e
57 changed files with 1531 additions and 615 deletions

View File

@@ -1,6 +1,8 @@
//! Main page view — sequencer grid, visualizations (scope/spectrum), script previews.
use std::collections::HashSet;
use std::sync::OnceLock;
use std::time::Instant;
use ratatui::layout::{Alignment, Constraint, Layout, Rect};
use ratatui::style::{Color, Modifier, Style};
@@ -361,6 +363,26 @@ fn render_sequencer(frame: &mut Frame, app: &App, snapshot: &SequencerSnapshot,
}
}
fn pulse_phase() -> f32 {
static EPOCH: OnceLock<Instant> = OnceLock::new();
let t = EPOCH.get_or_init(Instant::now).elapsed().as_secs_f32();
(1.0 + (t * std::f32::consts::TAU).sin()) * 0.5
}
fn pulse_color(color: Color) -> Color {
let Color::Rgb(r, g, b) = color else { return color };
let lum = 0.299 * r as f32 + 0.587 * g as f32 + 0.114 * b as f32;
let amp = pulse_phase() * 0.12;
let shift = |c: u8| -> u8 {
if lum < 128.0 {
(c as f32 + (255.0 - c as f32) * amp) as u8
} else {
(c as f32 * (1.0 - amp)) as u8
}
};
Color::Rgb(shift(r), shift(g), shift(b))
}
fn render_tile(
frame: &mut Frame,
area: Rect,
@@ -417,6 +439,7 @@ fn render_tile(
(false, false, _, _, true) => (theme.selection.in_range, theme.selection.cursor_fg),
(false, false, false, _, _) => (theme.tile.inactive_bg, theme.tile.inactive_fg),
};
let bg = if is_selected && !is_playing { pulse_color(bg) } else { bg };
let bg_fill = Paragraph::new("").style(Style::new().bg(bg));
frame.render_widget(bg_fill, area);