Skip to content

Commit

Permalink
feat: listen to external changes in vuetify theme
Browse files Browse the repository at this point in the history
  • Loading branch information
iisakkirotko committed Feb 13, 2024
1 parent f803ab9 commit 7c0c46a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions js/src/Themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export class ThemeModel extends WidgetModel {
this.on("change:dark", () => {
this.setTheme();
});

setInterval(() => {
this.vuetifyThemeChange();
}, 1000);
}

setTheme() {
Expand Down Expand Up @@ -67,6 +71,17 @@ export class ThemeModel extends WidgetModel {
this.set("dark_effective", vuetify.framework.theme.dark);
this.save_changes();
}

vuetifyThemeChange() {
if (
this.get("dark") !== null &&
this.get("dark") !== vuetify.framework.theme.dark
) {
this.set("dark", vuetify.framework.theme.dark);
this.set("dark_effective", vuetify.framework.theme.dark);
this.save_changes();
}
}
}

ThemeModel.serializers = {
Expand Down

0 comments on commit 7c0c46a

Please sign in to comment.