Dark mode at the color pallete config level #11919
Replies: 1 comment 1 reply
-
Relevant post by Adam Wathan, creator of Tailwind (emphasis mine):
|
Beta Was this translation helpful? Give feedback.
-
Relevant post by Adam Wathan, creator of Tailwind (emphasis mine):
|
Beta Was this translation helpful? Give feedback.
-
TW's current dark mode is already awesome!
But it would be even better if we could define in the
tailwind.config.js
file the corresponding dark version of a single color or an entire color palette. Thus, whatever the mode of application of the dark mode,class
,[attr]
ormedia
, TW would have the ability to search for thedark
correspondence of the colors defined in the config, without having to use the utilitydark:
in the class composition of an element.See the example below where we define 3 default application/site colors:
In the example I assumed that the color object will provide the inverted color palettes to aid in creating color palettes in the dark version. But logically we could adjust one by one or just the color graduations that we want to assume the
auto dark
behavior... Oops! I think I found a name for this functionality.Logically, we can already do this through the application's main CSS file, something like:
However, as we can see, it would be too verbose and laborious.
Maybe with a little more study and testing I'll be able to create a script that achieves this behavior, but I leave here the idea and who knows we can collaborate and officially see something in this sense in TailwindCSS.
Beta Was this translation helpful? Give feedback.
All reactions