Skip to content

Commit

Permalink
fix theme sync
Browse files Browse the repository at this point in the history
  • Loading branch information
inetol committed Feb 12, 2025
1 parent 71af426 commit 06c17e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion www/src/components/modals/settings/ThemeSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function ThemeSection() {
<input
type='checkbox'
id='theme-color-scheme-toggle'
class='toggle theme-controller'
class='toggle'
value='light'
disabled={themeSchemeMode() === 'device'}
checked={themeScheme() === 'light'}
Expand Down
8 changes: 6 additions & 2 deletions www/src/screens/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useLocation } from '@solidjs/router';
import { Suspense, lazy, onMount } from 'solid-js';
import { Suspense, createEffect, lazy, on } from 'solid-js';
import Header from '#component/Header.tsx';
import GenericFallback from '#screen/GenericFallback.tsx';
import { type LangKeys, langs, setLanguage } from '#util/langs.ts';
Expand All @@ -17,7 +17,11 @@ export default function EditorScreen() {
setLanguage(language as LangKeys);
}

onMount(() => document.documentElement.setAttribute('data-theme', themeScheme()));
createEffect(
on(themeScheme, (themeScheme) => {
document.documentElement.setAttribute('data-theme', themeScheme);
})
);

return (
/* FIXME: Overflows when width is over 1024px */
Expand Down

0 comments on commit 06c17e4

Please # to comment.