Allow use of custom data-theme values that also override auto light/dark switching #272
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm migrating https://github.com/immers-space/immers over to pico in order to make the style customizable for each server, and I love it. The extensive use of CSS custom properties means we can customize it at runtime without having to rebuild the web client.
We'd like to offer an additional built-in theme that is activated via
data-theme
attribute value, but we have an issue that settingdata-theme
to anything other thanlight
leaves the auto light/dark switch enabled, making that particular theme unreadable forprefers-color-scheme: dark
users.This tiny change makes it so any value for data-theme will disable the auto-switching. All of the existing behavior is preserved:
[data-theme=light]
shows light mode regardless of preference[data-theme=dark]
shows dark mode regardless of preference2022-11-03.11-10-33.mp4