Skip to main content

Function: deepMergeTheme()

deepMergeTheme(baseTheme: Theme, overrides: Partial<Theme>): Theme

Defined in: src/theme/utils/themeMerging.ts:99

Deep merge themes with proper type safety and nested object handling. Performs deep merging of nested objects like colors, typography, and spacing to ensure that only specified properties are overridden while preserving all other base theme properties.

Parametersโ€‹

baseThemeโ€‹

Theme

The base theme to start with

overridesโ€‹

Partial<Theme>

Partial theme object with overrides to apply

Returnsโ€‹

Theme

Merged theme with deep object merging applied

Remarksโ€‹

This utility handles all nested theme objects including:

  • Colors (with all sub-categories)
  • Typography (with font properties)
  • Spacing, shadows, borderRadius

Exampleโ€‹

const customTheme = deepMergeTheme(baseTheme, {
colors: {
primary: { main: "#custom-color" },
},
});