Replies: 3 comments 1 reply
-
You could consider setting colors dynamically using the CSS variables that typography uses: <div
className="prose"
style={{
--tw-prose-body: dynamicColor,
}}
> |
Beta Was this translation helpful? Give feedback.
-
Related: How to configure @tailwindcss/typography plugin from TailwindCSS v4 @utility prose-pink {
@apply prose;
& > * {
--tw-prose-body: var(--color-pink-800);
--tw-prose-headings: var(--color-pink-900);
}
} |
Beta Was this translation helpful? Give feedback.
-
The Specifically, only CSS variables can achieve this kind of "dynamic" behavior, because the variable name is fixed and never changes: <div class="font-(--fontFamily)" style={{ "--fontFamily": $fontFamily }} >Hello World</div> See more:
More example: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible for text styled with prose to use color set dynamically?
I have a color picker which allows a user to set a color, which I'm able to reflect in other components simply by setting style={{color: ${dynamicColor}}}, but can't seem to get it to work properly with tailwind typography.
Strangely, I am able to get dynamic font families to work, e.g. className={
font-${fontFamily}
} carries over just fine to typography.I'm also not able to set a default typography font color other than the default slate/neutral via
Beta Was this translation helpful? Give feedback.
All reactions