Allow configs to override default CSS theme values in theme() function provided to plugins and configs#14359
Conversation
| [key: string | number]: string | Colors | ||
| } | ||
|
|
||
| export function flattenColorPalette(colors: Colors) { |
There was a problem hiding this comment.
TODO: We need to expose this to the end user for backwards compatibility. I believe it's tailwindcss/lib/util/flattenColorPalette
There was a problem hiding this comment.
Really unfortunate it needs to live at tailwindcss/lib/util/flattenColorPalette and not tailwindcss/flattenColorPalette.
Do you think we should do this in this PR or a followup?
There was a problem hiding this comment.
Can that be something we configure in our exports config or copy over at build-time or something I wonder?
There was a problem hiding this comment.
I think we would still require a separate file to point to, but the paths should be fixable via exports I believe.
I also think that it should be a default export in the final result so that you can do const flattenColorPalette = require('...') which is what's currently used.
cea86ed to
14555ea
Compare
Previously, given the following CSS and configuration:
When a config or a plugin asked for the value of
theme(fontSize.base)like so:We would instead pull the values from the CSS theme even through they're marked with
@theme default. This would cause the incorrect font size and line height to be used resulting in something like this (in the case of the typography plugin with custom styles):After this change we'll now pull the values from the appropriate place (the config in this case) and the correct font size and line height will be used:
This will work even when some values are overridden in the CSS theme:
which would result in the following CSS: