File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,29 @@ export default defineConfig({
3535 transformers : [ transformerDirectives ( { enforce : 'pre' } ) ] ,
3636 theme : {
3737 colors : {
38- primary : tailwindColors . indigo ,
38+ /**
39+ * Defines a dynamic primary color palette based on Tailwind CSS's colors.
40+ *
41+ * ```ts
42+ * import tailwindColors from 'tailwindcss/colors';
43+ *
44+ * type ColorPalette = (typeof tailwindColors)[keyof typeof tailwindColors];
45+ *
46+ * function setPrimaryPalette(palette: ColorPalette) {
47+ * for (const [shade, color] of Object.entries(palette)) {
48+ * document.documentElement.style.setProperty(`--color-primary-${shade}`, color);
49+ * }
50+ * }
51+ *
52+ * setPrimaryPalette(tailwindColors.violet);
53+ * ```
54+ */
55+ primary : Object . fromEntries (
56+ Object . entries ( tailwindColors . indigo ) . map ( ( [ shade , color ] ) => [
57+ shade ,
58+ `var(--color-primary-${ shade } , ${ color } )` ,
59+ ] ) ,
60+ ) ,
3961 secondary : tailwindColors . neutral ,
4062 success : tailwindColors . emerald ,
4163 danger : tailwindColors . rose ,
You can’t perform that action at this time.
0 commit comments