Vite plugin for dynamically changing theme colors at runtime. Current version 2.0.1, requires Node >=20 and Vite >=7.0.0. Extracts color variables from CSS files after Vite processing, generates a separate theme style file (`app-theme-style.css`), and allows dynamic color replacement via JavaScript. Supports custom color variables, selectors, and injection points. Similar to webpack-theme-color-replacer but for Vite ecosystem. Minimal peer dependencies (only Vite).
npm install vite-plugin-theme-vite3Verified import paths — ran on the pinned version, not inferred.
Configure viteThemePlugin in vite.config.ts with color variables using tinycolor.
Upgrade Vite to >=7.0.0 and Node to >=20.0.0.
Pass an array of color strings (e.g., ['#1890ff']) to `colorVariables`.
Replace `resolveSelector` with `wrapperCssSelector`.
Use the `handleHotUpdate` API or disable HMR for CSS if needed.
Ensure color variables are not scoped, or use a custom `customerExtractVariable` function.
Run `pnpm add vite-plugin-theme-vite3 -D` and import from 'vite-plugin-theme-vite3' (no subpath).
Use `import { viteThemePlugin } from 'vite-plugin-theme-vite3'`.Upgrade Vite to >=7.0.0 or downgrade the plugin to v1.x (not recommended).
Add `colorVariables: ['#yourColor']` to the plugin options.
No dependency data recorded yet.