feat(gui): group the theme editor into labelled sections

The editor was one flat 13-row colour list. Split it into Surfaces / Text &
accent / Buttons / Status colours, each a bold subheading over its own grid,
via a new color_section helper. Pure layout — no behaviour change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-29 05:02:05 -04:00
parent ccd8c33f81
commit 472991c11f
+35 -19
View File
@@ -917,6 +917,19 @@ fn color_row(ui: &mut egui::Ui, label: &str, color: &mut egui::Color32) {
ui.end_row();
}
/// A titled group of [`color_row`]s in the theme editor — a bold subheading
/// then a two-column grid, so the palette reads as sections instead of one
/// long flat list. `id` must be unique per section (it salts the grid).
fn color_section(ui: &mut egui::Ui, title: &str, id: &str, rows: impl FnOnce(&mut egui::Ui)) {
ui.add_space(8.0);
ui.label(egui::RichText::new(title).strong());
ui.add_space(2.0);
egui::Grid::new(id)
.num_columns(2)
.spacing([12.0, 6.0])
.show(ui, rows);
}
impl PixelPassApp {
/// Drain child output and reflect it into the tray. Runs on every wake,
/// whether or not a window is shown, so notifications and the tray tooltip
@@ -1142,25 +1155,28 @@ impl PixelPassApp {
);
ui.add_space(6.0);
egui::Grid::new("theme_editor_grid")
.num_columns(2)
.spacing([12.0, 6.0])
.show(ui, |ui| {
let d = &mut self.theme.draft;
color_row(ui, "Window background", &mut d.window_bg);
color_row(ui, "Panel background", &mut d.panel_bg);
color_row(ui, "Input background", &mut d.input_bg);
color_row(ui, "Text", &mut d.text);
color_row(ui, "Secondary text", &mut d.weak_text);
color_row(ui, "Accent", &mut d.accent);
color_row(ui, "Button", &mut d.button_bg);
color_row(ui, "Button (hover)", &mut d.button_hovered);
color_row(ui, "Streaming", &mut d.streaming);
color_row(ui, "Waiting", &mut d.waiting);
color_row(ui, "Success", &mut d.success);
color_row(ui, "Warning", &mut d.warning);
color_row(ui, "Error", &mut d.error);
});
let d = &mut self.theme.draft;
color_section(ui, "Surfaces", "theme_grid_surfaces", |ui| {
color_row(ui, "Window background", &mut d.window_bg);
color_row(ui, "Panel background", &mut d.panel_bg);
color_row(ui, "Input background", &mut d.input_bg);
});
color_section(ui, "Text & accent", "theme_grid_text", |ui| {
color_row(ui, "Text", &mut d.text);
color_row(ui, "Secondary text", &mut d.weak_text);
color_row(ui, "Accent", &mut d.accent);
});
color_section(ui, "Buttons", "theme_grid_buttons", |ui| {
color_row(ui, "Button", &mut d.button_bg);
color_row(ui, "Button (hover)", &mut d.button_hovered);
});
color_section(ui, "Status colours", "theme_grid_status", |ui| {
color_row(ui, "Streaming", &mut d.streaming);
color_row(ui, "Waiting", &mut d.waiting);
color_row(ui, "Success", &mut d.success);
color_row(ui, "Warning", &mut d.warning);
color_row(ui, "Error", &mut d.error);
});
ui.add_space(10.0);
ui.horizontal(|ui| {