Skip to content

Commit

Permalink
refactor: conform to changes in ipyvuetify theme handling
Browse files Browse the repository at this point in the history
  • Loading branch information
iisakkirotko committed Feb 20, 2024
1 parent a4f5556 commit 3335abb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion solara/lab/components/theming.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def Page():
"""

def sync_themes(selected_theme: str):
selected_theme
theme.dark = selected_theme

return _ThemeToggle(
Expand Down
10 changes: 10 additions & 0 deletions solara/lab/components/theming.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
<script>
module.exports = {
mounted() {
if (theme.variant_user_selectable) {
if (localStorage.getItem('theme.variant')) {
this.theme_effective = this.initTheme();
}
}
if ( this.theme_effective === false ) {
this.clicks = 2;
} else if ( this.theme_effective === null ) {
Expand Down Expand Up @@ -42,6 +48,10 @@ module.exports = {
stringifyTheme() {
return this.theme_effective === true ? 'dark' : this.theme_effective === false ? 'light' : 'auto';
},
initTheme() {
storedTheme = JSON.parse(localStorage.getItem('theme.variant'));
return storedTheme === 'dark' ? true : storedTheme === 'light' ? false : null;
},
setTheme() {
if ( window.solara && this.theme_effective === null ) {
this.$vuetify.theme.dark = this.prefersDarkScheme();
Expand Down

0 comments on commit 3335abb

Please sign in to comment.