-
Notifications
You must be signed in to change notification settings - Fork 1
Fix dark mode colour scheme selector #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Change colorSchemeSelector from "class" to "data-mode" so that toggling dark mode updates the data-mode attribute and color-scheme CSS property on the root element, not just the CSS class.
ab0e25a to
84b61b9
Compare
akademy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently discussing if this is necessary.
Dark/Light Mode Toggling - Class/Style vs. Data AttributeWhen implementing a dark/light mode toggle, the core idea is to apply different styles based on the active theme. This can be achieved by manipulating HTML attributes on a high-level element (like 1. Changing
|
Summary
colorSchemeSelectorinBaseThemefrom"class"to"data-mode"so MUI toggles thedata-modeattribute on the root element whenColourSchemeButtonswitches dark modeNote: The ds-theme branch's
ThemeProvideralso needs aColorSchemeSyncfix (itsuseLayoutEffectsetsclassandcolor-schemeinline style from a staticmodeprop, which goes stale after toggling). That fix will go into ds-theme directly when it rebases on top of this.Fixes #130