feat(module): handle variants with dynamic colors

This commit is contained in:
Benjamin Canac
2022-06-30 17:16:22 +02:00
parent f98253c255
commit 5a8b078d65
5 changed files with 474 additions and 457 deletions

View File

@@ -1,22 +1,18 @@
export const safeColors = [
'primary',
'rose',
'pink',
'fuchsia',
'purple',
'violet',
'indigo',
'blue',
'sky',
'cyan',
'teal',
'emerald',
'green',
'lime',
'yellow',
'amber',
'orange',
'red'
import { omit, kebabCase } from './index'
export const colorsToExclude = [
'inherit',
'transparent',
'current',
'white',
'black',
'slate',
'gray',
'zinc',
'neutral',
'stone'
]
export const safeColorsAsRegex = safeColors.join('|')
export const excludeColors = (colors: object) => Object.keys(omit(colors, colorsToExclude)).map(color => kebabCase(color))
export const colorsAsRegex = (colors: string[]) => colors.join('|')