2024.5.0 (#39)

This commit is contained in:
Gregory Schier
2024-06-03 14:08:24 -07:00
committed by GitHub
parent 60e469a1c9
commit 4f9a7e9c88
197 changed files with 12283 additions and 3505 deletions

View File

@@ -0,0 +1,23 @@
import { emit } from '@tauri-apps/api/event';
import { useEffect } from 'react';
import type { YaakTheme } from '../lib/theme/window';
import { addThemeStylesToDocument, setThemeOnDocument } from '../lib/theme/window';
import { useResolvedTheme } from './useResolvedTheme';
export function useSyncThemeToDocument() {
const theme = useResolvedTheme();
useEffect(() => {
setThemeOnDocument(theme.active);
emitBgChange(theme.active);
}, [theme.active]);
useEffect(() => {
addThemeStylesToDocument(theme.active);
}, [theme.active]);
}
function emitBgChange(t: YaakTheme) {
if (t.background == null) return;
emit('yaak_bg_changed', t.background.hex()).catch(console.error);
}