Skip to content
PluginStats

tailwindcss-prefers-dark-mode weekly downloads statistics

By javifm86 · npm · Tailwind plugins

Tailwind CSS plugin that adds variants for @media (prefers-color-scheme: dark)

View on npm Fresh · Dec 6, 2026

tailwindcss-prefers-dark-mode has 40 recorded weekly downloads on npm, an increase of 11.1% over the past 30 days, ranking #2829 of 3,247 tracked listings.

Weekly downloads
40
Official API · Dec 5, 2026
7-day growth
-7.0%
-3 weekly downloads
30-day growth
+11.1%
+4 weekly downloads
90-day growth
+81.8%
+18 weekly downloads
Rank
#2829
▼ 183 in 7 days

About tailwindcss-prefers-dark-mode

Tailwindcss prefers dark mode

Tailwind CSS plugin that adds variants for [@media (prefers-color-scheme: dark)][2]. It can also generate dark variants with an activator CSS class on the html, body or any parent tag making the dark classes active allowing easily switch between light and dark theme.

Installation

npm install tailwindcss-prefers-dark-mode --save-dev

Add the plugin to the plugins array in your tailwind.config.js file.

module.exports = {
  // ...

  plugins: [
    // ...
    require('tailwindcss-prefers-dark-mode')({
      type: 'mediaQuery', // 'mediaQuery' or 'class'
      className: '.dark-mode', // Activator css class if type === 'class'
      prefix: 'dark' // Class name prefix for naming dark variants
    })
  ]
};

Plugin params

You can customize how dark variants are generated depending on the params passed to the plugin. The old behaviour was passing no params or just an empty string. You can continue using the old config but passing an object is prefered. These are the different posibilities:

  • No params. If no param is supplied, variants will be under @media (prefers-color-scheme: dark) and the default prefix for classes will be dark.
require('tailwindcss-prefers-dark-mode')();
  • Passing an string. In this case variants will be generated under @media (prefers-color-scheme: dark) but the prefix for classes will be the string passed. For example, with prefers-dark:
require('tailwindcss-prefers-dark-mode')('prefers-dark');
  • Passing an object allows you to choose between generate variants with @media (prefers-color-scheme: dark) or generate with an activator CSS class. Object properties:
    • type: mediaQuery if you want the option with @media (prefers-color-scheme: dark) or class if you prefer an activator CSS class. This field is required.
    • className: The activator CSS class if type is class. If no className is provided, .dark-mode class will be used as default.
    • prefix: Prefix for naming dark variants. If no prefix is provided, dark will be used as default.
require('tailwindcss-prefers-dark-mode')({
  type: 'class', // 'mediaQuery'
  className: '.dark-mode',
  prefix: 'dark'
});

Variants generated

  • dark
  • dark:hover
  • dark:focus
  • dark:active
  • dark:disabled
  • dark:odd
  • dark:even
  • dark:group-hover
  • dark:focus-within
  • dark:placeholder
<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"],
    placeholderColor: ['responsive', 'focus', 'dark:placeholder']
  }

You can check the full list of default variants in [Tailwind default config file][1].

Use @apply to inline any existing utility classes in dark mode

With @media (prefers-color-scheme: dark)

Just use prefers-color-scheme CSS media feature and apply Tailwind classes.

.btn {
  @apply font-bold py-2 px-4 rounded bg-red-500;
}

@media (prefers-color-scheme: dark) {
  .btn {
    @apply bg-gray-500;
  }
}
With activator CSS class

Just add the activator CSS class at the beggining of the selector and apply Tailwind classes.

.btn {
  @apply font-bold py-2 px-4 rounded bg-red-500;
}

.dark-mode .btn {
  @apply bg-gray-500;
}

Customize class name prefix for variants

dark is used as default prefix for variants generated. It´s possible to change dark for whatever you want, just pass any string as param or use prefix key if you pass an object as param to the plugin. For example, with prefers-dark:

module.exports = {
  // ...

  plugins: [
    // ...
    require('tailwindcss-prefers-dark-mode')('prefers-dark')
  ]
};
module.exports = {
  // ...

  plugins: [
    // ...
    require('tailwindcss-prefers-dark-mode')({
      type: 'class', // 'mediaQuery'
      className: '.dark-mode',
      prefix: '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'
  ];
}

Alternatives

If you're looking for a more complex approach, a different kind of configuration, or just want to know the alternatives, here is a list that you may find useful:…

Description from the npm listing.

  • tailwind
  • tailwindcss
  • postcss
  • dark-mode
  • tailwindcss-plugin

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

tailwindcss-prefers-dark-mode weekly downloads on npm, last 90 days: 40 weekly downloads as of Dec 5, 2026, +81.8% over 90 days.tailwindcss-prefers-dark-modeWeekly downloads on npm · Last 90 days40downloads / week+81.8% over 90 days01020304050607080Sep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
tailwindcss-prefers-dark-mode weekly downloads on npm, last 90 days: 40 weekly downloads as of Dec 5, 2026, +81.8% over 90 days.

7/30/90-day growth

tailwindcss-prefers-dark-mode weekly downloads growth on npm: -7.0% over 7 days, +11.1% over 30 days, +81.8% over 90 days.tailwindcss-prefers-dark-modeWeekly downloads growth on npm40downloads / week now7-day growth-3 weekly downloads-7.0%30-day growth+4 weekly downloads+11.1%90-day growth+18 weekly downloads+81.8%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
tailwindcss-prefers-dark-mode weekly downloads growth on npm: -7.0% over 7 days, +11.1% over 30 days, +81.8% over 90 days.

Ranking history

tailwindcss-prefers-dark-mode npm ranking history: currently #2829 (by weekly downloads).tailwindcss-prefers-dark-modenpm ranking · by weekly downloads · Last 90 days#2829current rank#1800#2000#2200#2400#2600#2800#3000Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
tailwindcss-prefers-dark-mode npm ranking history: currently #2829 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 142, #11 (overall #2,831)
All npm: every listing in weekly downloads order

Listing placement

Tailwind plugins292 listings · 15 pages · page 8, #4 (overall #144)
Tailwind plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (170)
Recent weekly downloads observations for tailwindcss-prefers-dark-mode
Date (UTC)Weekly downloadsChange vs. previous
400
40-2
42-1
43+8
35+3
32-10
42-1
43+1
42-1
43+1
42+1
41-2
43+10
33—

Similar npm Tailwind plugins plugins

All 20 tailwindcss-prefers-dark-mode alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/tailwindcss-prefers-dark-mode. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.