
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
@danestves/tailwindcss-darkmode
Advanced tools
Tailwind CSS plugin that adds variants for DarkMode.
# npm
npm install @danestves/tailwindcss-darkmode --save-dev
# yarn
yarn add --dev @danestves/tailwindcss-darkmode
Add the plugin to the plugins array in your tailwind.config.js file.
module.exports = {
// ...
plugins: [
// ...
require('@danestves/tailwindcss-darkmode')()
]
};
Actually the function receive two parameters:
prefix: default to dark.activatorClass: default to dark-mode.So if you want to rename the activatorClass you can make it as simple as:
module.exports = {
// ...
plugins: [
// ...
require('@danestves/tailwindcss-darkmode')('dark', 'my-custom-activator-class')
]
};
Note: These variants are activated when either the html or body tag has the class dark-mode. But you can change it.
darkdark:hoverdark:focusdark:activedark:disableddark:odddark:evendark:group-hoverdark:focus-within<div class="bg-gray-100 dark:bg-gray-800 border-t-4 border-green-500">
<nav class="flex flex-wrap justify-end items-center p-4">
<a class="text-gray-700 hover:bg-gray-300 dark:hover:bg-transparent dark:focus:text-green-500" href="#">Text</a>
</nav>
</div>
🚨 Dark variants must be enabled on each utility in your tailwind.config.js file. 🚨
variants: {
backgroundColor: [
"responsive",
"hover",
"focus",
"dark",
"dark:hover",
"dark:focus"
],
borderColor: [
"responsive",
"hover",
"focus",
"dark",
"dark:hover",
"dark:focus"
],
textColor: [
"responsive",
"hover",
"focus",
"group-hover",
"dark",
"dark:hover",
"dark:focus",
"dark:group-hover",
"focus-within",
"dark:focus-within",
"dark:odd",
"dark:even",
"dark:active",
"dark:disabled"
],
borderStyle: ["responsive", "dark"]
}
You can check the full list of default variants in the Tailwind default config file.
dark is used as default prefix for the variants that are generated. It´s possible to change dark for whatever you want, just pass any string as a param. For example, with prefers-dark:
module.exports = {
// ...
plugins: [
// ...
require('tailwindcss-prefers-dark-mode')('prefers-dark')
]
};
And variants must be named with the new prefix:
variants: {
textColor: [
'responsive',
'hover',
'focus',
'group-hover',
'prefers-dark',
'prefers-dark:hover',
'prefers-dark:focus',
'prefers-dark:group-hover',
'focus-within',
'prefers-dark:focus-within'
];
}
FAQs
Tailwind CSS plugin that adds variants for DarkMode
The npm package @danestves/tailwindcss-darkmode receives a total of 9 weekly downloads. As such, @danestves/tailwindcss-darkmode popularity was classified as not popular.
We found that @danestves/tailwindcss-darkmode demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.