feat(module): move colors options into theme.colors

This commit is contained in:
Benjamin Canac
2024-09-18 11:28:31 +02:00
parent d3317d828e
commit 2e954467c4
24 changed files with 95 additions and 92 deletions

View File

@@ -4,7 +4,7 @@ export default (options: Required<ModuleOptions>) => ({
base: 'rounded-md font-medium inline-flex items-center',
variants: {
color: {
...Object.fromEntries(options.colors.map((color: string) => [color, ''])),
...Object.fromEntries((options.theme.colors || []).map((color: string) => [color, ''])),
gray: ''
},
variant: {
@@ -19,19 +19,19 @@ export default (options: Required<ModuleOptions>) => ({
lg: 'text-sm px-2 py-1'
}
},
compoundVariants: [...options.colors.map((color: string) => ({
compoundVariants: [...(options.theme.colors || []).map((color: string) => ({
color,
variant: 'solid',
class: `bg-${color}-500 dark:bg-${color}-400 text-white dark:text-gray-900`
})), ...options.colors.map((color: string) => ({
})), ...(options.theme.colors || []).map((color: string) => ({
color,
variant: 'outline',
class: `text-${color}-500 dark:text-${color}-400 ring ring-inset ring-${color}-500/50 dark:ring-${color}-400/50`
})), ...options.colors.map((color: string) => ({
})), ...(options.theme.colors || []).map((color: string) => ({
color,
variant: 'soft',
class: `bg-${color}-500/10 dark:bg-${color}-400/10 text-${color}-500 dark:text-${color}-400`
})), ...options.colors.map((color: string) => ({
})), ...(options.theme.colors || []).map((color: string) => ({
color,
variant: 'subtle',
class: `bg-${color}-500/10 dark:bg-${color}-400/10 text-${color}-500 dark:text-${color}-400 ring ring-inset ring-${color}-500/25 dark:ring-${color}-400/25`