
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
@rstacruz/tailwind-variable-theming
Advanced tools
Small utility to define multiple themes using CSS variables
Small utility to define multiple themes using CSS variables
NB: This is a 0.x micro-utility.
// tailwind.config.js
const { createTheme } = require('@rstacruz/tailwind-variable-theming')
const { colors } = require('tailwindcss/defaultTheme')
// Define a theme
const theme = createTheme({
name: 'default',
colors: {
base: {
bodyBg: colors.white,
bodyText: colors.gray['900'],
},
input: {
baseBg: colors.gray['100'],
baseText: colors.gray['900'],
},
},
})
// Include the variables and the plugin to your Tailwind config
module.exports = {
theme: {
extend: {
colors: {
...theme.config.colors,
},
},
},
variants: {},
plugins: [theme.plugin],
}
:root {
@apply theme-default;
}
The config object (theme.config.colors) will define colors as CSS variables. This follows what Tailwind would recommend for switching themes (docs).
.box {
background: theme('colors.base.bodyBg');
/* → background: var(--base-body-bg); */
}
.paragraph {
@apply text-base-bodyBg;
/* → color: var(--base-body-bg); */
}
The plugin (theme.plugin) will create a utility to define those variables, which can be used in :root via @apply.
.theme-default {
--base-body-bg: #fff;
--base-body-text: #1a202c;
--input-body-bg: #f7fafc;
--input-body-text: #1a202c;
}
Two themes can be defined for default and dark themes.
// Define themes
const defaultTheme = createTheme({
name: 'default',
colors: {
/*...*/
},
})
const darkTheme = createTheme({
name: 'dark',
colors: {
/*...*/
},
})
// Include the variables and the plugin to your Tailwind config
module.exports = {
theme: {
extend: {
colors: {
// Only one will be needed here
...defaultTheme.config.colors,
},
},
},
variants: {},
plugins: [defaultTheme.plugin, darkTheme.plugin],
}
CSS media queries can be used to define an alternate theme.
:root {
@apply theme-default;
@media (prefers-color-scheme: dark) {
@apply theme-dark;
}
}
MIT
FAQs
Small utility to define multiple themes using CSS variables
We found that @rstacruz/tailwind-variable-theming 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
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

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.