diff options
Diffstat (limited to 'frontend/src/store/flowStore.ts')
| -rw-r--r-- | frontend/src/store/flowStore.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/frontend/src/store/flowStore.ts b/frontend/src/store/flowStore.ts index 3dac19f..7246a5a 100644 --- a/frontend/src/store/flowStore.ts +++ b/frontend/src/store/flowStore.ts @@ -306,7 +306,7 @@ const useFlowStore = create<FlowState>((set, get) => { archivedNodes: [], files: [], uploadingFileIds: [], - theme: 'light' as const, + theme: (window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') as const, projectTree: [], currentBlueprintPath: undefined, lastViewport: undefined, @@ -2677,4 +2677,9 @@ const useFlowStore = create<FlowState>((set, get) => { }; }); +// Sync initial theme to <html> element for global CSS +if (useFlowStore.getState().theme === 'dark') { + document.documentElement.classList.add('dark'); +} + export default useFlowStore; |
