Theme plugins (#231)

This commit is contained in:
Gregory Schier
2025-07-03 13:06:30 -07:00
committed by GitHub
parent a6979cf37e
commit 19c6ad9d97
64 changed files with 1754 additions and 1623 deletions

View File

@@ -27,13 +27,14 @@ configureTheme().then(
// Listen for settings changes, the re-compute theme
listen<ModelPayload>('upserted_model', async (event) => {
if (event.payload.model.model !== 'settings') return;
const model = event.payload.model.model;
if (model !== 'settings' && model !== 'plugin') return;
await configureTheme();
}).catch(console.error);
async function configureTheme() {
const settings = await getSettings();
const theme = getResolvedTheme(
const theme = await getResolvedTheme(
preferredAppearance,
settings.appearance,
settings.themeLight,
@@ -41,7 +42,7 @@ async function configureTheme() {
);
addThemeStylesToDocument(theme.active);
setThemeOnDocument(theme.active);
if (theme.active.surface != null) {
setWindowTheme(theme.active.surface.hexNoAlpha());
if (theme.active.base.surface != null) {
setWindowTheme(theme.active.base.surface);
}
}