Skip to content

Commit e1dcfd4

Browse files
balzssclaude
andcommitted
fix(regression-test): resolve the semantic page-background token via its factory
newTheme.semantics is a factory (primitives) => tokens, not a resolved object, so reading `.semantics.color.background.page` off it was always undefined and the background fell back to transparent (white) for every theme. Call the factory with newTheme.primitives — the same way emotion's useComputedTheme resolves it. Verified against the compiled themes: dark #10141A, light #F2F4F5, canvas #ffffff. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 68767a2 commit e1dcfd4

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

regression-test/src/app/layout.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,16 @@ export default function RootLayout({
7777
// screenshotted the way it's actually used — most visibly, the dark theme
7878
// renders on its near-black surface rather than on white. The value comes from
7979
// the theme's semantic tokens (canvas → white, light → faint grey, dark →
80-
// near-black), so it stays correct if those tokens change and needs no
81-
// per-theme hardcoding. Fall back to `transparent` if the token is ever absent.
82-
const pageBackground =
83-
(themes[themeKey] as any)?.newTheme?.semantics?.color?.background?.page ??
84-
'transparent'
80+
// near-black), so it needs no per-theme hardcoding. `newTheme.semantics` is a
81+
// factory that must be called with the theme's primitives to resolve the token
82+
// objects — the same way the library resolves them internally (emotion's
83+
// useComputedTheme). Fall back to `transparent` if the token is ever absent.
84+
const newTheme = (themes[themeKey] as any)?.newTheme
85+
const semantics =
86+
typeof newTheme?.semantics === 'function'
87+
? newTheme.semantics(newTheme.primitives)
88+
: newTheme?.semantics
89+
const pageBackground = semantics?.color?.background?.page ?? 'transparent'
8590

8691
return (
8792
// we need to make a new Map to reset counting on the server side

0 commit comments

Comments
 (0)