Fix system theme pair integration

This commit is contained in:
Yuri Karamian
2026-08-06 15:12:43 +02:00
parent aeddcc6e58
commit 1950c4cc3c
8 changed files with 73 additions and 52 deletions
+1 -18
View File
@@ -8,8 +8,7 @@
activeNotePath,
editorDirty,
readOnly,
sourceMode,
resolvedTheme
sourceMode
} from '$lib/stores/app';
import { readNote } from '$lib/api';
import { keybindings, matchAction } from '$lib/keybindings';
@@ -17,8 +16,6 @@
let { notePath }: { notePath: string } = $props();
import { darkThemes } from '$lib/platform';
const appWindow = getCurrentWindow();
const isMac = navigator.platform.startsWith('Mac');
let editor = $state<Editor>(null!);
@@ -36,20 +33,6 @@
return () => { unlisten.then(fn => fn()); };
});
$effect(() => {
const t = $resolvedTheme || 'light';
const namedThemes = ['solarized-light', 'solarized-dark', 'catppuccin', 'nord', 'tokyo-night', 'github-light', 'github-dark', 'dracula', 'blueberry', 'forest-green', 'gruvbox', 'midnight-tide', 'cherry-blossom', 'synthwave', 'ember', 'moonlit', 'light-coffee', 'dark-coffee', 'cotton-candy', 'crimson', 'cloud', 'peach', 'material-dark', 'material-light', 'monokai', 'rose-pine', 'everforest', 'horizon', 'cyberpunk', 'black', 'one-dark'];
const root = document.documentElement;
root.classList.remove('dark');
root.removeAttribute('data-theme');
if (namedThemes.includes(t)) {
root.setAttribute('data-theme', t);
if (darkThemes.includes(t)) root.classList.add('dark');
} else if (t === 'dark') {
root.classList.add('dark');
}
});
let lastMouseDown = 0;
const RESIZE_EDGE = 6;