Function: createThemeConfig()
createThemeConfig(
config
: {animation?
:AnimationConfig
;borderRadius?
:BorderRadiusConfig
;colors
:ThemeColors
;components?
:ComponentConfig
;shadows?
:ShadowConfig
;spacing?
:SpacingConfig
;typography?
:TypographyConfig
; }):ThemeConfig
Defined in: shared/types/themeConfig.ts:773
Creates a theme configuration factory with optional theme sections.
Parametersโ
configโ
Partial theme configuration with at least colors required
animation?โ
Animation and transition configuration
borderRadius?โ
Border radius configuration
colorsโ
Color configuration
components?โ
Component-specific styling
shadows?โ
Shadow configuration
spacing?โ
Spacing configuration
typography?โ
Typography configuration
Returnsโ
Complete theme configuration with defaults applied
Remarksโ
Uses SetOptional to create type-safe theme configuration functions where specific sections can be omitted when defaults are provided. This demonstrates practical usage of type-fest SetOptional for API design.
Exampleโ
// Create minimal theme with just colors, other sections use defaults
const minimalTheme = createThemeConfig({
colors: {
primary: { 50: "#f0f9ff", 500: "#3b82f6", 900: "#1e3a8a" },
},
});
// Create full custom theme
const fullTheme = createThemeConfig({
colors: customColors,
typography: customTypography,
spacing: customSpacing,
});