-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove fallbacks from theme var(...)
calls
#14881
Conversation
3c1874f
to
9507b58
Compare
@adamwathan Hey, I think this change has broken our theme. Previously we had it defined like this:
Variables such as I don't fully understand why but this doesn't work any more but it worked fine when the fallback values were set. I think it's because Tailwind defines the colors at I think this change also breaks class-based dark mode when using this variable-based colour system, since the "dark" class is applied on (eg) At a bit of a loose end with this one, let me know if you have any ideas, thanks! |
I have managed a bit of an ugly workaround... manually redefining all the color CSS variables every time one of the inner variables (eg.
I've had to copy and paste from the theme because it doesn't look like it's possible to use @apply within a theme |
@kieranm We have the @theme inline {
--color-primary: oklch(var(--primary));
--color-on-primary: oklch(var(--on-primary));
--color-background: oklch(var(--background));
--color-surface: oklch(var(--surface));
--color-elevated: oklch(var(--elevated));
} There's some more info on this here: #15280 (comment) We'll improve our documentation around this! |
Thanks @philipp-spiess will give that a go! Is it possible/recommended to use |
This PR changes how we render
var(...)
calls for theme values, removing the fallback values we were previously including.We previously included the fallbacks only so you could see the value in dev tools but this feels like a bad reason to bloat the CSS. I'd rather just convince the Chrome team to surface this stuff better in dev tools in the first place.