app: give the window a palette and the settings a quick tab

The colours were rune's neutral defaults, so nothing tied the screens
together. app/src/theme.rs now holds the palette: near-black surfaces
tinted blue, brass for what the user acts on, mint and coral kept for
results so champion art stays the loudest thing on screen. A test
fails the build if a colour that carries text drops under 4.5:1 in
either appearance.

Settings lose the empty General tab: Quick holds quality, the audio and
microphone switches, startup and the recordings folder; Recording keeps
the encoder and output; Audio is three cards instead of five; Advanced
absorbs the audio bitrate and reset. The back button moves to the left
of the title bar, where window navigation belongs, and text fields
right-align their value like every other control on the row.

The microphone picker lists the devices with "System default" first,
naming the default endpoint under the row.

Two smaller repairs found on the way: the app picked
record-daemon/target/release before debug, so it talked to a stale
daemon after a debug build (the newest build now wins), and --snap
forwarded its arguments to a running window instead of rendering.
This commit is contained in:
vhaudiquet committed 2026-11-16 19:06:36 +01:00
1 parent b82225ce08
commit 3dfef1961d
8 files changed
+628 -368

No files matched your search

+67 -16
View File
@@ -1,6 +1,6 @@
//! Shared colours and small controls for the screens.
use rune::tok::{self, Theme, motion, radius, space, type_};
use rune::tok::{Theme, motion, radius, space, type_};
use rune::{Color, Drag, El, Phase, TextStyle, col, el, row, text};
use crate::app::App;
@@ -9,17 +9,28 @@ use crate::app::App;
pub struct Paint {
pub t: Theme,
pub accent: Color,
pub dark: bool,
pub accent_ink: Color,
pub success: Color,
pub danger: Color,
pub warning: Color,
pub chrome: Color,
pub field: Color,
pub hair: f32,
pub scale: f32,
}
impl Paint {
pub fn new(dark: bool, scale: f32) -> Self {
let palette = crate::theme::palette(dark);
Self {
t: tok::theme(dark),
accent: tok::accent(0, dark),
dark,
t: palette.theme,
accent: palette.accent,
accent_ink: palette.accent_ink,
success: palette.success,
danger: palette.danger,
warning: palette.warning,
chrome: palette.chrome,
field: palette.field,
hair: 1.0 / scale,
scale,
}
@@ -28,14 +39,6 @@ impl Paint {
pub fn muted(&self) -> Color {
self.t.text_secondary
}
pub fn danger(&self) -> Color {
tok::accent(2, self.dark)
}
pub fn success(&self) -> Color {
tok::accent(4, self.dark)
}
}
pub fn heading(size: f32) -> TextStyle {
@@ -272,6 +275,46 @@ pub fn slider(
)
}
/// A one-line text field for a settings row. The text sits at the row's end edge, like every
/// other control, so values start and end on one line down the card.
pub fn text_field(
p: Paint,
key: &'static str,
label: &str,
edit: &rune::TextEdit,
to: fn(&mut App) -> &mut rune::TextEdit,
) -> El {
let focused = edit.focused;
row()
.key(key)
.h(28.0)
.w(220.0)
.px(8.0)
.center_y()
.radius(radius::MD)
.fill(p.field)
.border(
p.hair,
if focused {
p.accent.alpha(0.7)
} else {
p.t.card_border
},
)
.child(
rune::text_input(edit, type_::BODY)
.key("input")
.single_line()
.w_full()
.label(label)
.color(p.t.text)
.align(rune::Align::End)
.caret(p.t.text, p.accent.alpha(0.3))
.on_edit(to)
.on_input_change(|app: &mut App, _| app.form.dirty = true),
)
}
/// A pill tab; the selected one fills with the accent.
pub fn tab(
p: Paint,
@@ -285,15 +328,23 @@ pub fn tab(
.label(label)
.checked(selected)
.focusable(true)
.px(14.0)
.px(18.0)
.h(28.0)
.center()
.radius(radius::MD)
.fill(if selected {
p.accent.alpha(0.16)
p.accent.alpha(0.22)
} else {
Color::TRANSPARENT
})
.border(
p.hair,
if selected {
p.accent.alpha(0.32)
} else {
Color::TRANSPARENT
},
)
.hover(p.t.hover)
.press(p.t.press)
.on_press(on_press)
@@ -334,7 +385,7 @@ pub fn button(
text(label)
.key("label")
.font(type_::LABEL)
.color(if primary { Color::WHITE } else { p.t.text })
.color(if primary { p.accent_ink } else { p.t.text })
.a11y_hidden(),
)
}