feat: migrate Lumo colors to CSS light-dark() and color-scheme#11266
Merged
Conversation
Use the CSS light-dark() function for all color variables that differ between light and dark mode, replacing the previous approach of redefining ~55 variables in a [theme~="dark"] selector block. The dark block now only sets color-scheme: dark, which triggers light-dark() to pick the dark values. Also adds theme="light-dark" support (color-scheme: light dark) so the browser can follow the user's system preference automatically.
Test light mode defaults, dark mode on document and subtree, registered custom property updates in subtree dark mode, and light-dark theme mode.
Properties registered as <color> via CSS.registerProperty() resolve their var() chain at definition time, so changing color-scheme on a subtree does not trigger recomputation. Re-setting them in the dark and light-dark blocks ensures they recompute in the correct context.
jouni
approved these changes
Mar 6, 2026
web-padawan
reviewed
Mar 6, 2026
Keep all dark variable redefinitions in the [theme~='dark'] block so
that users who only overrode the light value of a variable still get a
proper dark fallback. Without this, a light-only override like
html { --lumo-base-color: pink } would apply to both modes.
Also add backwards compatibility tests verifying that light-only and
light+dark user overrides work correctly.
|
web-padawan
approved these changes
Mar 6, 2026
Collaborator
|
This ticket/PR has been released with Vaadin 25.1.0-beta3. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Use the CSS light-dark() function for all color variables that differ between light and dark mode, replacing the previous approach of redefining 55 variables in a [theme~="dark"] selector block. The dark block now only sets color-scheme: dark, which triggers light-dark() to pick the dark values.
Also adds theme="light-dark" support (color-scheme: light dark) so the browser can follow the user's system preference automatically.