feat(qbz-theme): transcribe 24 standard themes into the registry

P2 of the theme migration. Materialize every non-accessibility theme
from src/app.css (per 01-tauri-themes-inventory.md): the core Light row
plus the 23 branded/community themes (warm, nord, dracula,
catppuccin-mocha, breeze-dark, adwaita-dark, alucard, aurora, ikari,
ayanami, iscariot, stratego, rumi, zoey, mira, rose-pine-dawn,
breeze-light, adwaita-light, duotone-snow, snow-storm, frost, langley,
kurosaki).

- No CSS cascade on the Slint side: every row is fully materialized.
  Omitted tokens (light's accent trio; breeze-dark/adwaita-dark's
  danger/warning families) are resolved against :root Dark at
  transcription time.
- Alpha polarity is luminance-derived, not the Tauri type flag: frost
  (#2e3440) and langley (#2c0a0a) are registered light but are dark
  canvases -> white alpha base; alucard (#fffbeb) is genuinely light ->
  black base. surface_hover/border_muted bases flip with polarity too.
- Status families (danger/warning) are baked as straight-alpha tints of
  the solid hue (0.1/0.3/0.2; dracula 0.15/0.4/0.25; light hover 0.15),
  matching Tauri's rgba() derivation.
- Derived (no Tauri parity) per-theme: success (project green #3fae6a on
  dark, #1f8a4c on light), focus_ring (= accent), favorite (= danger).
  These are placeholders to be polished in P4.
- is_implemented() now reports all standard themes ready; the 5
  accessibility themes remain gated for P3.

Adds a full-population smoke test over every registered theme plus
per-theme hero-value, polarity and non-standard-tint assertions.
cargo test -p qbz-theme: 33 passed.

cc
This commit is contained in:
vicrodh committed 2026-06-20 15:05:03 -06:00
1 parent 71f92e62a3
commit 40bd77f70f
3 files changed
+993 -32

No files matched your search

+5 -6
View File
@@ -114,13 +114,12 @@ impl ThemeId {
ThemeId::Oled
}
/// Whether this theme is fully materialized by the registry in P1. Used by
/// the frontend list builder to expose only ready themes during P1/P2.
/// Whether this theme is fully materialized by the registry. Used by the
/// frontend list builder to expose only ready themes during the phased
/// rollout. After P2 every standard (non-accessibility) theme is materialized;
/// the 5 accessibility themes are filled in P3.
pub fn is_implemented(self) -> bool {
matches!(
self,
ThemeId::Dark | ThemeId::Oled | ThemeId::TokyoNight | ThemeId::System
)
!matches!(self.category(), ThemeCategory::Accessibility)
}
/// Stable persisted slug. MUST NOT change once shipped.
+29 -2
View File
@@ -102,14 +102,41 @@ mod tests {
}
#[test]
fn implemented_list_is_the_four_p1_themes() {
fn implemented_list_is_all_standard_themes() {
// After P2 every non-accessibility theme is materialized; the 5 a11y
// themes (WcagLight/WcagDark/HighContrast/HighContrastLight/Colorblind)
// land in P3.
let list = implemented_theme_list();
assert_eq!(list.len(), 4);
assert_eq!(list.len(), ALL.len() - 5);
let slugs: Vec<&str> = list.iter().map(|e| e.slug).collect();
// P1 originals still present:
assert!(slugs.contains(&"dark"));
assert!(slugs.contains(&"oled"));
assert!(slugs.contains(&"tokyo-night"));
assert!(slugs.contains(&"system"));
// P2 additions (spot-check across categories):
assert!(slugs.contains(&"light"));
assert!(slugs.contains(&"nord"));
assert!(slugs.contains(&"dracula"));
assert!(slugs.contains(&"frost"));
assert!(slugs.contains(&"langley"));
assert!(slugs.contains(&"alucard"));
assert!(slugs.contains(&"kurosaki"));
// accessibility themes NOT yet implemented:
assert!(!slugs.contains(&"wcag-dark"));
assert!(!slugs.contains(&"high-contrast"));
assert!(!slugs.contains(&"colorblind"));
}
#[test]
fn light_dark_filter_is_luminance_correct() {
// Corrected flags: Alucard light; Frost/Langley dark despite Tauri type.
assert!(is_light(ThemeId::Alucard));
assert!(is_light(ThemeId::Light));
assert!(is_light(ThemeId::SnowStorm));
assert!(!is_light(ThemeId::Frost));
assert!(!is_light(ThemeId::Langley));
assert!(!is_light(ThemeId::Nord));
}
#[test]
File diff suppressed because it is too large. Load diff