Skip to main content

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?โ€‹

AnimationConfig

Animation and transition configuration

borderRadius?โ€‹

BorderRadiusConfig

Border radius configuration

colorsโ€‹

ThemeColors

Color configuration

components?โ€‹

ComponentConfig

Component-specific styling

shadows?โ€‹

ShadowConfig

Shadow configuration

spacing?โ€‹

SpacingConfig

Spacing configuration

typography?โ€‹

TypographyConfig

Typography configuration

Returnsโ€‹

ThemeConfig

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,
});