feat(интерфейс): светлая тема при первом визите, тёмная — по выбору

Первый визит больше не уходит в тёмную тему из-за системной настройки: без
сохранённого выбора страница светлая. Переключатель по-прежнему главнее системы,
выбор остаётся после перезагрузки. Проверка на первую страницу смотрит системную
тёмную настройку и повторный визит.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
anor
2026-11-18 21:30:20 +10:00
co-authored by Claude Code
parent 7ae5fff7e2
commit df5bfd93b1
10 changed files with 36 additions and 13 deletions
+1 -1
View File
@@ -447,7 +447,7 @@ th[data-hint] { cursor: help; text-decoration: underline dotted;
/* Тема и оформление — до первой отрисовки, иначе человек видит вспышку чужого вида.
Две независимые оси: data-theme (светлая/тёмная) и data-design (набор оформления). */
var DESIGNS=['calm','dense','bold','glass'];
(function(){try{var t=localStorage.getItem('theme');if(t!=='dark'&&t!=='light'){t=(window.matchMedia&&matchMedia('(prefers-color-scheme: dark)').matches)?'dark':'light';}document.documentElement.setAttribute('data-theme',t);}catch(e){}})();
(function(){try{var t=localStorage.getItem('theme');if(t!=='dark'&&t!=='light'){t='light';}document.documentElement.setAttribute('data-theme',t);}catch(e){}})();
(function(){var d='calm';try{var v=localStorage.getItem('design');if(DESIGNS.indexOf(v)>=0)d=v;}catch(e){}document.documentElement.setAttribute('data-design',d);})();
function toggleTheme(){var n=document.documentElement.getAttribute('data-theme')==='dark'?'light':'dark';document.documentElement.setAttribute('data-theme',n);try{localStorage.setItem('theme',n);}catch(e){}applyThemeIcon();}
function applyThemeIcon(){var b=document.getElementById('theme-toggle');if(b)b.textContent=document.documentElement.getAttribute('data-theme')==='dark'?'☀ Светлая тема':'🌙 Тёмная тема';}