fix(theme): add default value for custom theme properties (#5195)

* fix(theme): add default value for custom theme properties

* chore(changeset): add issue number

---------

Co-authored-by: աӄա <wingkwong.code@gmail.com>
This commit is contained in:
il-1337 2025-04-29 05:42:10 +08:00 committed by GitHub
parent 31476000d0
commit dd60608886
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 9 deletions

View File

@ -0,0 +1,5 @@
---
"@heroui/theme": patch
---
add default value for custom theme properties (#5194)

View File

@ -277,15 +277,15 @@ export const heroui = (config: HeroUIPluginConfig = {}): ReturnType<typeof plugi
Object.entries(otherThemes).forEach(([themeName, {extend, colors, layout}]) => {
const baseTheme = extend && isBaseTheme(extend) ? extend : defaultExtendTheme;
if (colors && typeof colors === "object") {
otherThemes[themeName].colors = deepMerge(semanticColors[baseTheme], colors);
}
if (layout && typeof layout === "object") {
otherThemes[themeName].layout = deepMerge(
extend ? baseLayouts[extend] : defaultLayoutObj,
layout,
);
}
const baseColors = semanticColors[baseTheme];
otherThemes[themeName].colors =
colors && typeof colors === "object" ? deepMerge(baseColors, colors) : baseColors;
const baseLayout = extend ? baseLayouts[extend] : defaultLayoutObj;
otherThemes[themeName].layout =
layout && typeof layout === "object" ? deepMerge(baseLayout, layout) : baseLayout;
});
const light: ConfigTheme = {