Listening for browser and device theme changes and updating #11014
nhwilly
started this conversation in
Show and tell
Replies: 2 comments 2 replies
-
Greetings! Could you please (If possible) share the working sample with us? |
Beta Was this translation helpful? Give feedback.
2 replies
-
The JS api of the an example: BitTheme.init({
...,
onChange: (newTheme: string, oldTheme: string) => {
if (newTheme === 'dark') {
document.body.classList.add('theme-dark');
document.body.classList.remove('theme-light');
} else {
document.body.classList.add('theme-light');
document.body.classList.remove('theme-dark');
}
}
}); you can utilize it and call a .NET static method using the Blazor js api |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I spent some time yesterday creating a small service that will allow my app to respond to a user changing their theme preference.
Seems to work pretty well.
Does this already exist in BitUi?
If not, would you like me to share it? If so, where?
Beta Was this translation helpful? Give feedback.
All reactions