-
Notifications
You must be signed in to change notification settings - Fork 33
Description
We have a custom "yellow" theme in our app. To support both light and dark modes for it, we created yellow-light and yellow-dark variants. We apply these via ScopedTheme:
<ScopedTheme theme="yellow-dark">
<Card /> {/* uses dark: utility classes */}
</ScopedTheme>The problem is that dark: utility classes (like dark:bg-card) don't apply inside ScopedTheme theme="yellow-dark". They work fine under the plain dark theme, but not under any custom theme that's meant to be a dark variant.
This means we can use dark: without a ScopedTheme, but not with one that has a custom dark theme name.
Cause
In src/core/native/store.ts around line 137:
|| (style.theme !== null && theme !== style.theme)This does a strict equality check. When the active theme is yellow-dark, styles tagged as dark: are skipped because "dark" !== "yellow-dark".
Expected behavior
dark: styles should apply when the active theme is any dark variant (e.g. yellow-dark, blue-dark).
Suggested fix
|| (style.theme !== null && theme !== style.theme && !(style.theme === 'dark' && theme.endsWith('-dark')))This could also handle light variants with custom light themes:
|| (style.theme !== null && theme !== style.theme && !(style.theme === 'dark' && theme.endsWith('-dark')) && !(style.theme === 'light' && theme.endsWith('-light')))Reproduction
- Define a custom theme
yellow-darkin your CSS with dark mode overrides - Wrap a component in
<ScopedTheme theme="yellow-dark"> - Any
dark:utility classes (e.g.dark:bg-card) inside that tree will not be applied