From 5905f461802aa38caeebb059b43a349dd3be357d Mon Sep 17 00:00:00 2001 From: callumalpass Date: Wed, 25 Nov 2026 12:51:58 +1100 Subject: [PATCH] Let ancestors theme the workspace, and follow the page's colour scheme 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. --- README.md | 3 ++- demo/index.html | 1 + package.json | 2 +- src/styles.css | 14 ++++++++------ 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 24a2e1b..72e7dd7 100644 --- a/README.md +++ b/README.md @@ -181,7 +181,8 @@ for screen readers, and animation between layouts (off when the system asks for Colours and sizes come from custom properties (`--mp-bg`, `--mp-surface`, `--mp-header-bg`, `--mp-border`, `--mp-text`, `--mp-muted`, `--mp-accent`, `--mp-drop`, and so on) set on -`.mp-workspace` or any ancestor. +`.mp-workspace` or any ancestor. The default colours follow the page's `color-scheme`: set +`color-scheme: light dark` on the root to follow the system, or `light` or `dark` to fix it. The core can be used without React: `computeLayout(state, size, options)` returns rectangles for every stack, panel and splitter, `dropTargetAt` says where a dragged panel would land, and diff --git a/demo/index.html b/demo/index.html index 7864005..9af7c26 100644 --- a/demo/index.html +++ b/demo/index.html @@ -5,6 +5,7 @@ mdbase panels demo