freezmo/components/ThemeSection.tsx
Martin Dvorak e56653dae1 Frutiger Aero theme, pixel-measured contrast fixes, sheet surfaces
Frutiger Aero (Settings -> Theme): a third theme, not a dark/light variant.
A sky gradient with a strip of grass, the glacier blobs become clouds, the
orbs soap bubbles, glass gets the classic horizon gloss and the buttons a
glossy aqua. The light/dark toggles (header, rail, chat header) hide while it
is on and the picker says why; the pre-paint script applies the class before
first paint and the PWA status bar follows (#3fa3e0). Its muted/frost text is
darker than Light's because those labels sit directly on the sky.

Contrast, measured on real pixels (tests/contrast.mjs, now covering aero):
- The light settings sheet was translucent over a dark scrim, so its muted
  text measured ~2.8:1. Sheets and dialogs now use --glass-sheet-bg (a more
  opaque surface), and Light's --text-muted is a touch darker.
- Result: 0 below-minimum findings and 0 axe violations across every screen,
  all three themes, phone and desktop.

Also: the suites now seed the cookie notice as already dismissed (they run as
a returning user); the regression suite opts out to test the notice itself —
the previous deploy failed its gate because the notice blocked a chat chip
click. The notice also hides during immersive sessions (overlay-open), so it
can never cover a study feed.

Version 0.1.8, SW -> freezmo-v54.
2026-10-12 22:10:16 +00:00

45 lines
1.5 KiB
TypeScript

"use client";
import { useTheme, type Theme } from "@/components/ThemeToggle";
import { haptic } from "@/lib/haptics";
import { useI18n } from "@/lib/i18n";
const OPTIONS: Array<{ id: Theme; labelKey: string }> = [
{ id: "light", labelKey: "common.lightMode" },
{ id: "dark", labelKey: "common.darkMode" },
{ id: "aero", labelKey: "theme.aero" },
];
/**
* The theme picker: light, dark, or Frutiger Aero. Aero is not a dark/light
* variant — it swaps the whole palette and scene — which is why the light/dark
* toggles (header, rail, chat header) disappear while it is on.
*/
export function ThemeSection() {
const { theme, setTheme } = useTheme();
const { t } = useI18n();
return (
<section className="mb-4 space-y-3 rounded-2xl border border-[var(--hairline)] bg-[var(--surface-sunken)] p-3">
<h3 className="text-sm font-semibold text-frost-950 dark:text-frost-50">{t("settings.theme")}</h3>
<div className="segmented" role="group" aria-label={t("settings.theme")}>
{OPTIONS.map((option) => (
<button
key={option.id}
type="button"
aria-pressed={theme === option.id}
onClick={() => {
haptic("toggle");
setTheme(option.id);
}}
>
<span className="seg-label">{t(option.labelKey)}</span>
</button>
))}
</div>
{theme === "aero" ? (
<p className="text-[11px] leading-snug text-[var(--text-subtle)]">{t("theme.aeroNote")}</p>
) : null}
</section>
);
}