Unify colors via theme CSS variables; theme egui visuals

Add Theme::var(name, ctx) (CSS custom-property getter) and Theme::apply_to_egui(ctx)
which maps the palette onto egui's global Visuals so standard widgets share the
theme colors. Add a mobile::palette::Palette built from the theme each frame and
replace the duplicated per-file C_* color constants across all mobile modules
(omni, topbar, stack, inspector, transport, intent, shell) with it. Add --scrim
and --accent-* category vars to styles.css. Apply the theme visuals every frame in
update(). Mobile and the main UI now share one CSS-variable-driven palette that
responds to light/dark/user themes.
This commit is contained in:
Skyler Lehmkuhl
2026-07-01 07:08:00 -04:00
parent f13a127c9d
commit 943ff7c15f
11 changed files with 255 additions and 154 deletions
@@ -21,11 +21,14 @@ pub mod icons;
mod inspector;
pub mod intent;
mod omni;
mod palette;
mod stack;
mod surface;
mod topbar;
mod transport;
use palette::Palette;
/// Reserved sentinel namespace for mobile pane-instance paths. Desktop layout paths are built
/// from small child indices, so prefixing with `usize::MAX` guarantees mobile slots never alias a
/// real layout path in the shared `pane_instances` map.
@@ -203,9 +206,10 @@ pub fn render_mobile_shell(
rc: &mut RenderContext,
state: &mut MobileState,
) {
// Background (wireframe device color; bands paint over most of it).
ui.painter()
.rect_filled(available_rect, 0.0, egui::Color32::from_rgb(0x14, 0x16, 0x1b));
let pal = Palette::from_theme(rc.shared.theme, ui.ctx());
// Background (device color; bands paint over most of it).
ui.painter().rect_filled(available_rect, 0.0, pal.bg);
let topbar_rect = egui::Rect::from_min_max(
available_rect.min,
@@ -243,19 +247,19 @@ pub fn render_mobile_shell(
region
};
stack::render(ui, stack_rect, rc, state);
stack::render(ui, stack_rect, rc, state, &pal);
if inspector_shown {
let sheet_rect = egui::Rect::from_min_max(egui::pos2(region.left(), sheet_top), region.max);
inspector::render(ui, sheet_rect, region.height(), rc, state);
inspector::render(ui, sheet_rect, region.height(), rc, state, &pal);
}
// Transport floor: drawn last = always on top, the persistent spine.
transport::render(ui, transport_rect, &mut rc.shared);
transport::render(ui, transport_rect, &mut rc.shared, &pal);
// Omnibutton FAB (radial tool menu) — drawn above the stack region, on top of everything else.
omni::render(ui, region, rc, state);
omni::render(ui, region, rc, state, &pal);
// Top bar (filename + ⌕ palette + ⋯ commands). Its menus overlay the whole shell, so it's last.
topbar::render(ui, topbar_rect, available_rect, rc, state);
topbar::render(ui, topbar_rect, available_rect, rc, state, &pal);
}