Commit a077ba8
committed
fix(playground): gate Tailwind dark: variant on the theme class
appkit-ui's globals.css already defines dark-theme tokens via two paths
— an explicit `.dark` class on <html>, and `@media (prefers-color-scheme:
dark)` guarded by `:root:not(.light)` so an explicit `.light` class
wins. Tailwind v4's default `dark:` variant, however, is purely media
driven. That mismatch shows up when the user forces light via the
playground's theme selector while their OS is in dark mode: the
bootstrap script sets `<html class="light">`, --card/--background
correctly resolve to light, but every `dark:*` utility keeps firing
under the media query — cards end up painted with dark-mode
backgrounds layered under light-mode chrome.
Declare a playground-local `@custom-variant dark` that mirrors the
token logic exactly: fire when the element is (or descends from)
`.dark`, or when `prefers-color-scheme: dark` matches and no `.light`
ancestor is present. This rebinds every `dark:*` utility to respect
the theme selector's forced choice, keeping the rest of appkit-ui's
consumers — which don't ship the bootstrap script — on the existing
media-only behaviour.1 parent 37fa683 commit a077ba8
1 file changed
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
0 commit comments