-
Notifications
You must be signed in to change notification settings - Fork 310
Add color and scale plugin options #291
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@sambauers Hey thanks for the PR! This is a neat idea, although I'm not fully convinced it's the right API. We've been feeling for a long time that the way that this plugin is configured is overly complicated, so I'm really hesitant to add even more configuration options. I'd honestly rather find a way to simplify the whole story. For example, in some ways I kind of wish that instead of a plugin we simply provided folks with a chunk of example CSS that they could just copy and paste into their projects and modify as needed. Given that, I think I'm going to close this PR for now, as I don't feel confident in committing to supporting this feature long term. It may be something we eventually revisit, especially as we look at ways to improve the overall customization story for this plugin. I hope that makes sense! That all said, here are some suggestions that might help. First, I think if I was in your position I would simply create a Alternatively, for setting the default colors, you can do this via the config by extending the const colors = require('tailwindcss/colors')
module.exports = {
theme: {
extend: {
typography: ({ theme }) => ({
DEFAULT: {
css: {
'--tw-prose-body': theme('colors.pink[800]'),
'--tw-prose-headings': theme('colors.pink[900]'),
'--tw-prose-lead': theme('colors.pink[700]'),
'--tw-prose-links': theme('colors.pink[900]'),
'--tw-prose-bold': theme('colors.pink[900]'),
'--tw-prose-counters': theme('colors.pink[600]'),
'--tw-prose-bullets': theme('colors.pink[400]'),
'--tw-prose-hr': theme('colors.pink[300]'),
'--tw-prose-quotes': theme('colors.pink[900]'),
'--tw-prose-quote-borders': theme('colors.pink[300]'),
'--tw-prose-captions': theme('colors.pink[700]'),
'--tw-prose-code': theme('colors.pink[900]'),
'--tw-prose-pre-code': theme('colors.pink[100]'),
'--tw-prose-pre-bg': theme('colors.pink[900]'),
'--tw-prose-th-borders': theme('colors.pink[300]'),
'--tw-prose-td-borders': theme('colors.pink[200]'),
'--tw-prose-invert-body': theme('colors.pink[200]'),
'--tw-prose-invert-headings': theme('colors.white'),
'--tw-prose-invert-lead': theme('colors.pink[300]'),
'--tw-prose-invert-links': theme('colors.white'),
'--tw-prose-invert-bold': theme('colors.white'),
'--tw-prose-invert-counters': theme('colors.pink[400]'),
'--tw-prose-invert-bullets': theme('colors.pink[600]'),
'--tw-prose-invert-hr': theme('colors.pink[700]'),
'--tw-prose-invert-quotes': theme('colors.pink[100]'),
'--tw-prose-invert-quote-borders': theme('colors.pink[700]'),
'--tw-prose-invert-captions': theme('colors.pink[400]'),
'--tw-prose-invert-code': theme('colors.white'),
'--tw-prose-invert-pre-code': theme('colors.pink[300]'),
'--tw-prose-invert-pre-bg': 'rgb(0 0 0 / 50%)',
'--tw-prose-invert-th-borders': theme('colors.pink[600]'),
'--tw-prose-invert-td-borders': theme('colors.pink[700]'),
},
},
}),
},
},
plugins: [require('@tailwindcss/typography')],
}Here is a Tailwind Play illustrating this: https://play.tailwindcss.com/4sKePQbNaI. Notice how I'm only including the For the size stuff there unfortunately isn't really an easy way to do this, other than to customize the plugin's CSS. We've definitely found that there is a threshold with this plugin where it just makes more sense to write your own custom typography styles. Hope that helps, and thanks either way for this contribution 👍 |
|
I realised after reading your comment I can use postcss to solve my problem (using a component seems like overkill). I just created a new class in my @tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
.my-prose{
@apply
prose
prose-pink
prose-sm
sm:prose-base
lg:prose-lg
xl:prose-xl
2xl:prose-2xl;
}
}I found I had to put the class in the <main>
/* Use gray text for this section only */
<section className='my-prose prose-gray'>{markdown}</section>
</main>I suppose there is probably also a way to add this class within a tiny inline plugin in the Tailwind config, but I haven't tried that (I imagine |
Adds the ability to specify default
color(gray scale) andscale(type scale) - this saves an implementor from specifying their preferences on every element where they utiliseprose.The associated PR for the documentation website is here tailwindlabs/tailwindcss.com#1475