feat: includeColors to make the themes lightweight
This commit is contained in:
14
src/index.ts
14
src/index.ts
@@ -4,24 +4,26 @@ import generateNeutralColor from '@/colors/generateNeutralColor.js'
|
||||
import buttonRecipe from '@/recipes/button.js'
|
||||
import { detailsRecipe } from '@/recipes/details.js'
|
||||
import inputRecipe from '@/recipes/input.js'
|
||||
import type { BrandColor, ColorVariation, NeutralColor } from '@/types.js'
|
||||
import { type BrandColor, type Color, type ColorVariation, color, type NeutralColor } from '@/types.js'
|
||||
import generateSemanticColors from './colors/generateSemanticColors.js'
|
||||
|
||||
export type themeConfig = {
|
||||
export type ThemeConfig = {
|
||||
neutral?: NeutralColor
|
||||
semanticColors?: Record<string, BrandColor>
|
||||
colorVariation?: ColorVariation
|
||||
includeColors?: Color[]
|
||||
}
|
||||
|
||||
const defaultConfig: Required<themeConfig> = {
|
||||
const defaultConfig: Required<ThemeConfig> = {
|
||||
neutral: 'slate',
|
||||
colorVariation: { dark: false, p3: false, alpha: false },
|
||||
semanticColors: { primary: 'teal' }
|
||||
semanticColors: { primary: 'teal' },
|
||||
includeColors: color
|
||||
}
|
||||
|
||||
const srJuggernautPandaPreset = (config?: themeConfig) => {
|
||||
const srJuggernautPandaPreset = (config?: ThemeConfig) => {
|
||||
const mergedConfig = { ...defaultConfig, ...config }
|
||||
const colors = generateColors()
|
||||
const colors = generateColors(config?.includeColors)
|
||||
const neutral = generateNeutralColor(mergedConfig.neutral, mergedConfig.colorVariation)
|
||||
const semanticColors = generateSemanticColors(mergedConfig.semanticColors, mergedConfig.colorVariation)
|
||||
return definePreset({
|
||||
|
||||
Reference in New Issue
Block a user