Skip to content

Let ancestors theme the workspace, and follow the page's colour scheme (0.4.0) - #1

Merged
callumalpass merged 1 commit into
mainfrom
theme-from-ancestors
Nov 25, 2026
Merged

callumalpass merged 1 commit into
mainfrom
theme-from-ancestors

Conversation

@callumalpass

Copy link
Copy Markdown
Member

The colour defaults were declared on .mp-workspace itself, so a theme set on an ancestor never reached the workspace, though the stylesheet and README said it could. The workspace also forced color-scheme: light dark, so light-dark() inside it (the host app's own tokens included) followed the system setting instead of the page's theme. The mdbase Editor in light mode on a dark system showed a dark tab strip with a near-invisible active tab title.

  • Defaults move to :where(:root) (no specificity), so a value on the workspace or any ancestor wins.
  • The workspace no longer sets color-scheme; the page decides. The README says how to follow the system, and the demo does.
  • The drop highlight is derived where it is used, so it follows an overridden --mp-accent.

Breaking for pages that relied on the workspace following the system unstyled, hence 0.4.0.

Checked: typecheck, 53 tests and build pass. Rendered in headless Chrome against the Editor's tokens and stylesheet, for Editor light/dark × system light/dark: all four now follow the Editor's theme.

The colour defaults were declared on .mp-workspace itself, so a theme set on an
ancestor never reached the workspace, despite the stylesheet and README saying
it could. The workspace also forced `color-scheme: light dark`, so light-dark()
inside it, the host app's own tokens included, followed the system setting
rather than the page's theme: an app in light mode on a dark system got a dark
tab strip.

Move the defaults to `:where(:root)`, where a value on the workspace or any
ancestor wins, and stop setting color-scheme so the page decides. Derive the
drop highlight where it is used so it follows an overridden accent.

Pages that relied on the workspace following the system unstyled now need
`color-scheme: light dark` on the root; the demo sets it.
@callumalpass
callumalpass merged commit 765c3ac into main Nov 25, 2026
1 check passed
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