Skip to content

fix(framework): make theme-inverted sections take the alt colors - #635

Merged
DavidBabinec merged 1 commit into
mainfrom
fix/theme-default-class
Oct 13, 2026
Merged

DavidBabinec merged 1 commit into
mainfrom
fix/theme-default-class

Conversation

@DavidBabinec

Copy link
Copy Markdown
Contributor

The bug

Color tokens with an alt (dark) value emit their alt scope under :root.theme-default .theme-inverted, but nothing ever puts theme-default on <html>. A section with theme-inverted or theme-always-alt never switched, on published pages or in the canvas.

The fix

The default branch of the theme scopes now keys on :root:not(.theme-alt), so it matches every page as rendered today with no extra markup. A runtime toggle stays one class: adding theme-alt flips the page and every inverted section back. Sites with no dark-mode token emit no theme CSS, so their output is unchanged.

Verification

New tests parse the generated CSS and check Element.matches on a real document, both from generateFrameworkRootCss and from a published page. They fail on main and pass here.

(fail) publishPage > a theme-inverted section on a published page takes the alt color values
BUILD_EXIT=0  LINT_EXIT=0  TEST_EXIT=0
 7125 pass
 0 fail

The color theme scopes hung the default branch off :root.theme-default, a class nothing ever put on <html>, so theme-inverted and theme-always-alt never matched on published pages or in the canvas. The default branch now keys on :root:not(.theme-alt), which matches every page as rendered today and keeps a runtime toggle to the one theme-alt class.
@DavidBabinec
DavidBabinec merged commit b0366bc into main Oct 13, 2026
11 checks passed
@DavidBabinec
DavidBabinec deleted the fix/theme-default-class branch October 13, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant