Add a "配色方案" picker offering the four Catppuccin flavors as full color schemes alongside the default sky theme. - Schema: new `palette` field on UiAppearance (core + client mirror), normalized to a 5-value whitelist defaulting to 'default'. - Apply: each flavor's base/surface tokens are injected into the shared theme stylesheet over :root (Latte) or .dark (the three dark flavors); accent (--primary/--ring) stays separate so it composes. A flavor fixes light/dark (Latte→light, rest→dark), overriding `mode`, and forces dark-intensity to soft so the OLED "black" rule can't fight the palette. sidebar-style + high-contrast still compose (higher specificity). - Pre-paint bootstrap is palette-aware (no light↔dark flash on reload). - Settings: swatch-preview picker; mode + dark-intensity controls disable while a flavor is active. The top-bar ThemeToggle hides then (it would be inert under a fixed-scheme palette).
60 lines
3.5 KiB
HTML
60 lines
3.5 KiB
HTML
<!doctype html>
|
|
<html lang="zh-CN" class="light" data-theme="light">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<link rel="icon" type="image/png" href="/logo.png" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
|
<meta name="theme-color" content="#0ea5e9" />
|
|
<!-- WebUI is an admin surface; tell every compliant crawler to skip it. -->
|
|
<meta name="robots" content="noindex, nofollow, noarchive, nosnippet" />
|
|
<meta name="googlebot" content="noindex, nofollow, noarchive, nosnippet" />
|
|
<meta name="bingbot" content="noindex, nofollow, noarchive, nosnippet" />
|
|
<title>SnowLuma 控制台</title>
|
|
<!-- Pre-paint theme bootstrap: applies the cached appearance to <html>
|
|
before the bundle mounts, so dark/OLED/density/scale don't flash from
|
|
the default light theme. Mirrors a subset of ThemeContext.applyAppearance;
|
|
defensive (never breaks page load). The bundle re-applies authoritatively. -->
|
|
<script>
|
|
(function () {
|
|
try {
|
|
var raw = localStorage.getItem('snowluma_ui_appearance');
|
|
if (!raw) return;
|
|
var a = JSON.parse(raw);
|
|
if (!a || typeof a !== 'object') return;
|
|
var root = document.documentElement;
|
|
var mode = a.mode;
|
|
var pal = a.palette;
|
|
// A Catppuccin flavor fixes light/dark; Latte = light, the rest dark.
|
|
var isCpn = typeof pal === 'string' && pal.indexOf('catppuccin-') === 0;
|
|
var resolved = pal === 'catppuccin-latte' ? 'light'
|
|
: isCpn ? 'dark'
|
|
: (mode === 'light' || mode === 'dark'
|
|
? mode
|
|
: (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'));
|
|
root.classList.remove('light', 'dark');
|
|
root.classList.add(resolved);
|
|
root.setAttribute('data-theme', resolved);
|
|
root.style.colorScheme = resolved;
|
|
if (isCpn) root.setAttribute('data-palette', pal);
|
|
if (a.density === 'compact' || a.density === 'cozy') root.setAttribute('data-density', a.density);
|
|
// Catppuccin forces soft so the OLED "black" rule can't fight the palette.
|
|
var intensity = isCpn ? 'soft' : a.darkIntensity;
|
|
if (intensity === 'black' || intensity === 'soft') root.setAttribute('data-dark-intensity', intensity);
|
|
if (a.sidebarStyle === 'follow' || a.sidebarStyle === 'panel' || a.sidebarStyle === 'accent') root.setAttribute('data-sidebar-style', a.sidebarStyle);
|
|
root.setAttribute('data-contrast', a.highContrast ? 'high' : 'normal');
|
|
root.setAttribute('data-reduce-motion', a.reduceMotion ? '1' : '0');
|
|
if (typeof a.radius === 'number' && a.radius >= 0 && a.radius <= 2) root.style.setProperty('--radius', a.radius + 'rem');
|
|
if (typeof a.uiScale === 'number' && a.uiScale >= 0.5 && a.uiScale <= 2) root.style.fontSize = 16 * a.uiScale + 'px';
|
|
} catch (e) { /* ignore — fall back to default theme */ }
|
|
})();
|
|
</script>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Noto+Sans+SC:wght@400;500;600;700&display=swap" rel="stylesheet" />
|
|
</head>
|
|
<body>
|
|
<div id="root"></div>
|
|
<script type="module" src="/src/main.tsx"></script>
|
|
</body>
|
|
</html>
|