Replies: 2 comments 3 replies
-
No |
Beta Was this translation helpful? Give feedback.
-
Hey @DNature 👋 When implementing dark mode interfaces, you likely don't always want to just "swap" or invert colors, and often need much more "fine control", to make contextual decisions on a lot of parts of the UI. Here's a tweet by Steve Schoger that captures this really well: https://twitter.com/steveschoger/status/1151160261170126850 For that reason, even if this requires much more work to implement a dark UI, we have decided to go with the If you want to implement dark mode with the change of a single variable on the parent, you can define your colors as CSS custom properties (CSS variables), and then redefine these properties within a scoped toggle class name. Here's a good, basic example of that, that was created by Adam Wathan a while ago: https://github.com/adamwathan/theming-tailwind-demo Hope this helps 👍 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In most cases, I prefer my theme config file (
tailwind.config.js
) file to automatically handle styles for both light and dark mode.Example:
module.exports = { theme: { extend: { colors: { primary: { + 100: ["#000000", '#E4C1AF'] }, ...
The above feels more consistent.
That's an array where the first item is the
light theme color
and the last item is thedark theme color
Now you're not required to use the
dark:text-primary-100
-- Things just works out of the box.I can as well take care of this?
Beta Was this translation helpful? Give feedback.
All reactions