Skip to content

Commit

Permalink
incorporate suggestions from code review + discussions
Browse files Browse the repository at this point in the history
  • Loading branch information
iisakkirotko committed Feb 13, 2024
1 parent bdaa3ca commit f803ab9
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions js/src/Themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,44 +46,26 @@ export class ThemeModel extends WidgetModel {
} else if (document.body.dataset.jpThemeLight) {
vuetify.framework.theme.dark =
document.body.dataset.jpThemeLight === "false";
this.set("dark_effective", vuetify.framework.theme.dark);
this.save_changes();
} else if (document.body.classList.contains("theme-dark")) {
vuetify.framework.theme.dark = true;
this.set("dark", true);
this.save_changes();
} else if (document.body.classList.contains("theme-light")) {
this.set("dark", false);
this.save_changes();
vuetify.framework.theme.dark = false;
} else if (window.Jupyter) {
// Special case for Jupyter Notebook
this.set("dark", false);
this.save_changes();
vuetify.framework.theme.dark = false;
} else if (document.body.dataset.vscodeThemeKind === "vscode-dark") {
// Special case for VS Code
vuetify.framework.theme.dark = true;
this.set("dark", true);
this.save_changes();
} else if (document.body.dataset.vscodeThemeKind === "vscode-light") {
vuetify.framework.theme.dark = false;
this.set("dark", false);
this.save_changes();
} else if (document.documentElement.matches("[theme=dark]")) {
// Special case for Colab
vuetify.framework.theme.dark = true;
this.set("dark_effective", true);
this.save_changes();
} else if (document.documentElement.matches("[theme=light]")) {
vuetify.framework.theme.dark = false;
this.set("dark_effective", false);
this.save_changes();
} else {
let osPrefersDark =
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches;
vuetify.framework.theme.dark = osPrefersDark;
this.set("dark_effective", osPrefersDark);
this.save_changes();
}
this.set("dark_effective", vuetify.framework.theme.dark);
this.save_changes();
}
}

Expand Down

0 comments on commit f803ab9

Please sign in to comment.