Skip to content

Commit

Permalink
Update Themes.js
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbreddels committed Feb 6, 2024
1 parent 17d1d39 commit 53f0c5d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion js/src/Themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class ThemeModel extends WidgetModel {
}
}, this);
}

if (this.get("dark") !== null) {
vuetify.framework.theme.dark = this.get("dark");
} else if (document.body.dataset.jpThemeLight) {
Expand All @@ -50,9 +50,18 @@ export class ThemeModel extends WidgetModel {
} else if (document.body.classList.contains("theme-light")) {
this.set("dark", false);
this.save_changes();
} else if(window.Jupyter) {
this.set("dark", false);
this.save_changes();
} else {
// e.g. solara
let osPrefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
this.set("dark_jlab", osPrefersDark);
this.save_changes();
}
this.on("change:dark", () => {
vuetify.framework.theme.dark = this.get("dark");
// TODO: call the same code as in the constructor
});
}
}
Expand Down

0 comments on commit 53f0c5d

Please sign in to comment.