File tree Expand file tree Collapse file tree 6 files changed +12
-12
lines changed Expand file tree Collapse file tree 6 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 11import { Colors } from './type'
22
3- export { defineColorVariables } from './plugin'
3+ export { variableColorsPlugin } from './plugin'
44
55type VariableColors = {
66 [ key in keyof Colors ] : Colors [ key ] extends `#${string } `
Original file line number Diff line number Diff line change 11import colors from 'tailwindcss/colors'
22
33import { describe , expect , it } from 'vitest'
4- import { createColorVariables } from '../src/plugin'
4+ import { generateColorVariables } from '../src/plugin'
55
66describe ( 'should' , ( ) => {
77 it ( 'match snapshot' , ( ) => {
8- expect ( createColorVariables ( colors ) ) . toMatchInlineSnapshot ( `
8+ expect ( generateColorVariables ( colors ) ) . toMatchInlineSnapshot ( `
99 {
1010 "&.dark": {
1111 "--tw-color-amber-100": "120 53 15",
Original file line number Diff line number Diff line change @@ -4,18 +4,18 @@ import { Colors } from './type'
44interface Options {
55 mode ?: 'invert'
66}
7- export function defineColorVariables < T extends Colors > (
7+ export function variableColorsPlugin < T extends Colors > (
88 colors : T ,
99 options : Options = { } ,
1010) {
1111 return plugin ( ( { addBase } ) => {
1212 addBase ( {
13- ':root' : createColorVariables ( colors ) ,
13+ ':root' : generateColorVariables ( colors ) ,
1414 } )
1515 } )
1616}
1717
18- export function createColorVariables < T extends Colors > ( colors : T ) {
18+ export function generateColorVariables < T extends Colors > ( colors : T ) {
1919 const colorVariables = { } as any
2020 const darkColorVariables = { } as any
2121
Original file line number Diff line number Diff line change 11import { test , expect } from 'vitest'
22import postcss from 'postcss'
33import tailwindcss from 'tailwindcss'
4- import { createVariableColors , defineColorVariables } from '.'
4+ import { createVariableColors , variableColorsPlugin } from '.'
55import colors from 'tailwindcss/colors'
66
77// @ts -ignore
@@ -20,7 +20,7 @@ test('main', async () => {
2020 theme : {
2121 colors : createVariableColors ( colors ) ,
2222 } ,
23- plugins : [ defineColorVariables ( colors ) ] ,
23+ plugins : [ variableColorsPlugin ( colors ) ] ,
2424 } ,
2525 } ) ,
2626 pruneVar ( ) ,
Original file line number Diff line number Diff line change 11import { Config } from 'tailwindcss'
22import colors from 'tailwindcss/colors'
3- import { createVariableColors , defineColorVariables } from './src'
3+ import { createVariableColors , variableColorsPlugin } from './src'
44
55const config : Config = {
66 content : [ './src/**/*.tsx' ] ,
77 theme : {
88 colors : createVariableColors ( colors ) ,
99 } ,
10- plugins : [ defineColorVariables ( colors ) ] ,
10+ plugins : [ variableColorsPlugin ( colors ) ] ,
1111}
1212
1313export default config
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { Config } from 'tailwindcss'
22import colors from 'tailwindcss/colors'
33import {
44 createVariableColors ,
5- defineColorVariables ,
5+ variableColorsPlugin ,
66} from 'tailwindcss-variable-colors'
77
88const config : Config = {
@@ -25,7 +25,7 @@ const config: Config = {
2525 padding : '1rem' ,
2626 } ,
2727 } ,
28- plugins : [ defineColorVariables ( colors ) ] ,
28+ plugins : [ variableColorsPlugin ( colors ) ] ,
2929}
3030
3131export default config
You can’t perform that action at this time.
0 commit comments