Skip to content

feat(dashboard): glance-style theming — 17 server-resolved presets#66

Open
ndandan wants to merge 10 commits into
Shoshuo:mainfrom
ndandan:pr/dashboard-themes
Open

feat(dashboard): glance-style theming — 17 server-resolved presets#66
ndandan wants to merge 10 commits into
Shoshuo:mainfrom
ndandan:pr/dashboard-themes

Conversation

@ndandan

@ndandan ndandan commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Dashboard theming (glance-style presets)

Adds a single admin-chosen instance theme to Settings → Display (beside the existing accent picker), restyling the whole UI from a curated catalogue of 17 presets adapted from glance's docs/themes.md.

What it does

  • Each preset is a full colour model — HSL background / primary / positive / negative plus contrast and text-saturation multipliers and a light/dark flag — matching glance's model.
  • The chosen preset is resolved server-side into concrete CSS variables (no flash of unstyled colour; --tblr-primary-rgb is precomputed) and injected into base.html.twig.
  • The accent picker gains a "theme default" option that follows the chosen theme's primary.
  • The old per-browser light/dark toggle is removed — the theme now owns the mode.

Visual no-op by default

The default preset (midnight) reproduces the previous dark look exactly (bg #111111, cards #1c1c1c, footer #161616, sidebar #0d0d0d, primary #6366f1) — the HSL values are calibrated so integer round-trips land on those hexes. Existing installs see no change until a theme is picked.

Architecture

App\Theme\ColorMath (HSL→hex/rgb) → App\Theme\ThemePresets (the 17-preset data table) → App\Service\ThemeService::resolve() (returns {key, light, primary_hex, primary_rgb, css}, ResetInterface-cached) → App\Twig\ThemeExtension (theme() fn). display_theme is a <select> in AdminSettingsController, kept in sync with ThemePresets by a test.

Two non-obvious fixes (called out in case they're useful elsewhere)

  • Turbo Drive keeps the persistent <html> across visits, so a server-set theme attribute won't flip on a Turbo navigation. The themed :root vars live in a <style data-turbo-track="reload"> block, so a theme change forces one full reload; normal navigation stays fast.
  • The sticky topbar uses a themed --prismarr-topbar-bg (theme bg + .95 alpha) rather than a hardcoded rgba(17,17,17,.95), or it would show a near-black gap on every non-midnight theme.

Definition of Done

  • make check (lint + lint:twig + full PHPUnit) is green647 tests, 1839 assertions — run in a booted production container (the CI path). New tests: ColorMathTest, ThemePresetsTest, ThemeServiceTest, AdminSettingsThemeTest, ThemeRenderTest, plus DisplayPreferencesServiceTest updates.
  • New strings are i18n'd (en + fr).
  • CHANGELOG.md [Unreleased] and README.md updated.
  • Verified live (dark + light themes, all 17 presets) on a real deployment.

Note: cross-fork PR workflows need a maintainer "approve and run" before checks appear here, so the green run above was produced locally via the same make check the CI job runs.

ndandan and others added 10 commits June 26, 2026 07:45
…no-op)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The sticky search/topbar used a hardcoded rgba(17,17,17,.95), so on any
non-midnight theme (e.g. Nord) it stayed near-black and read as a dark
gap above the themed page background. Emit a translucent --prismarr-topbar-bg
(theme bg + .95 alpha, preserving the blur backdrop) and consume it; border
also follows --prismarr-border. Drop the now-redundant light-mode bg override.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ual refresh

base.html.twig is served under Turbo Drive, which keeps the persistent <html>
element across visits. data-bs-theme is a server-rendered <html> attribute, so
after saving a new theme Turbo swapped the body but left the old data-bs-theme,
making text unreadable until a manual refresh. Move the themed :root vars into
their own <style data-turbo-track="reload"> block: identical on every page
(normal visits stay fast), but a theme/accent change makes it differ so Turbo
forces a full reload that re-parses data-bs-theme and the vars together.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds glance's documented themes (exact HSL from glance docs/themes.md):
Catppuccin Latte/Frappe/Macchiato/Mocha, Dracula, Gruvbox Dark, Kanagawa Dark,
Teal City, Camouflage, Tucan, Shades of Purple, Neon Pink, Peachy, Zebra.
Updates Catppuccin Mocha + Gruvbox to glance's exact values (gruvbox -> gruvbox_dark),
drops the generic clean_light (glance lights cover it), keeps midnight (default
no-op), nord, solarized_light. Omitted glance positive/negative get a sensible
green/red; omitted multipliers -> 1.0. DISPLAY_OPTIONS + en/fr labels kept in
sync (sync test enforces it).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant