feat(portal): default to dark theme for new visitors
Memind CI / Test, build, and release guards (push) Successful in 3m11s
Memind CI / Test, build, and release guards (push) Successful in 3m11s
First-time and cleared-storage users see dark mode; saved light preference is unchanged. Inline boot script avoids a light flash before React loads. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+10
-1
@@ -1,7 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<html lang="zh-CN" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script>
|
||||
(function () {
|
||||
var key = 'memind-theme';
|
||||
var stored = localStorage.getItem(key);
|
||||
var theme = stored === 'light' || stored === 'dark' ? stored : 'dark';
|
||||
document.documentElement.dataset.theme = theme;
|
||||
document.documentElement.style.colorScheme = theme;
|
||||
})();
|
||||
</script>
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
function getStoredTheme() {
|
||||
const stored = localStorage.getItem(THEME_STORAGE_KEY);
|
||||
return stored === 'dark' ? 'dark' : 'light';
|
||||
if (stored === 'dark' || stored === 'light') return stored;
|
||||
return 'dark';
|
||||
}
|
||||
|
||||
function applyTheme(theme) {
|
||||
|
||||
+2
-1
@@ -4,7 +4,8 @@ export const THEME_STORAGE_KEY = 'memind-theme';
|
||||
|
||||
export function getStoredTheme(): MemindTheme {
|
||||
const stored = localStorage.getItem(THEME_STORAGE_KEY);
|
||||
return stored === 'dark' ? 'dark' : 'light';
|
||||
if (stored === 'dark' || stored === 'light') return stored;
|
||||
return 'dark';
|
||||
}
|
||||
|
||||
export function applyTheme(theme: MemindTheme) {
|
||||
|
||||
Reference in New Issue
Block a user