-
Notifications
You must be signed in to change notification settings - Fork 285
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
prose-invert not working as expected #228
Comments
I think invert works only with default - |
This is not true, that is why they include all the |
I'd need to revisit my code now (been a while), but I also couldn't make it work |
I could probably get a repository with a minimal reproduction this weekend. I am currently running into this. |
This can be resolved by moving the invert modifier (https://github.com/tailwindlabs/tailwindcss-typography/blob/master/src/styles.js#L923-L943) below all the gray and color modifiers to the end of defaultModifiers in |
Just spent a little time looking into this, don't have a solution yet but wanted to leave some notes for myself so I don't forget: The root problem here is that when we added This means that One possible solution is trying to make sure |
Just in case someone else runs across this, you can temporarily work around this with |
Thanks for pointing to I am using Maybe specifically adding :root to the invert-rule could solve this issue? |
v0.5.9 + tailwindcss v3.2.2 still has this issue. Could someone update the DOC? I spent a couple of hours on it and then find this address. |
I tried the suggested <body class="text-gray-900 dark:text-gray-100 bg-gray-100 dark:bg-gray-900">
<article class="prose dark:!prose-invert"> <!-- also tried <article class="prose !prose-invert"> -->
<h1>My Heading</h1>
</article>
</body> This CSS rule gets applied: .prose :where(h1):not(:where([class~=not-prose] *)) {
color:var(--tw-prose-headings);
}
.prose {
--tw-prose-headings: #111827;
} I can't find any code like Using tailwindcss-rails 2.0.29 (corresponding to Tailwind CSS v3.3.2 according to the release note) and the Rails-generated config: const defaultTheme = require('tailwindcss/defaultTheme')
module.exports = {
content: [
'./public/*.html',
'./app/helpers/**/*.rb',
'./app/javascript/**/*.js',
'./app/views/**/*.{erb,haml,html,slim}'
],
theme: {
extend: {
fontFamily: {
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
},
},
},
plugins: [
require('@tailwindcss/forms'),
require('@tailwindcss/aspect-ratio'),
require('@tailwindcss/typography'),
require('@tailwindcss/container-queries'),
]
} |
Thank you. |
Hey folks! Thanks for reporting this issue. I implemented what @adamwathan suggested above in #315, and from my testing this seems to fix this issue without any negative side effects. Hoping to get a new release of the plugin out tomorrow if all goes well 👍 |
Thank you for this fix! Unfortunately I think I've run into an edge case. This seems to work for the built-in themes, but not if you work with a custom theme. Here is a reproduction: https://play.tailwindcss.com/TRN5em5a8E As a summary of the reproduction linked above: HTML<div class="prose prose-invert prose-custom bg-slate-200">
<p>Curabitur blandit tempus ardua ridiculus sed magna. Sed haec quis possit intrepidus aestimare tellus. Quisque ut dolor gravida, placerat libero vel, euismod. Plura mihi bona sunt, inclinet, amari petere vellent.</p>
</div> Trying to use Config/** @type {import('tailwindcss').Config} */
module.exports = {
theme: {
extend: {
typography: (theme) => ({
custom: {
css: {
'--tw-prose-body': theme('colors.black'),
'--tw-prose-invert-body': theme('colors.white'),
},
},
}),
},
},
plugins: [require('@tailwindcss/typography')],
} With this config, I'd expect the above HTML to render as white text, but it renders as black text. This seems like the same behavior that the plugin had for all the themes prior to the fix. Perhaps the same thing is happening to the potential custom themes? |
@iansedano Put For eg: |
What version of @tailwindcss/typography are you using?
v0.5.0
What version of Node.js are you using?
v12.0.0
What browser are you using?
Chrome
What operating system are you using?
macOS
Reproduction repository
https://play.tailwindcss.com/vkmcuQsUPz
Describe your issue
I may be misunderstanding how
prose-invert
works, but in the Tailwind Play example where it's used in combination with a custom color theme (in this caseprose-white
) the inversed colours are not being applied.prose-white prose-invert
I would expect--tw-prose-body
to be set totheme.colors.black
.The text was updated successfully, but these errors were encountered: