Skip to content

feat: migrate Lumo colors to CSS light-dark() and color-scheme#11266

Merged
web-padawan merged 5 commits into
mainfrom
lumo-color-scheme
Mar 6, 2026
Merged

feat: migrate Lumo colors to CSS light-dark() and color-scheme#11266
web-padawan merged 5 commits into
mainfrom
lumo-color-scheme

Conversation

@Artur-
Copy link
Copy Markdown
Member

@Artur- Artur- commented Mar 6, 2026

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.

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.
@Artur- Artur- requested a review from jouni March 6, 2026 12:52
Artur- added 2 commits March 6, 2026 13:46
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.
@Artur- Artur- marked this pull request as ready for review March 6, 2026 13:52
Comment thread packages/vaadin-lumo-styles/test/color-scheme.test.js Outdated
web-padawan and others added 2 commits March 6, 2026 16:03
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.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 6, 2026

@web-padawan web-padawan merged commit 7df8f0e into main Mar 6, 2026
12 of 13 checks passed
@web-padawan web-padawan deleted the lumo-color-scheme branch March 6, 2026 16:04
@vaadin-bot
Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 25.1.0-beta3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants