diff --git a/src/Theme/index.ts b/src/Theme/index.ts index 8b161ce..552168b 100644 --- a/src/Theme/index.ts +++ b/src/Theme/index.ts @@ -36,12 +36,14 @@ const generateTheme = (options: { themes: ThemeInput[]; generateColorShades?: boolean | ShadesOptions; }) => { + let themes = options.themes; + if ( options.generateColorShades !== undefined && options.generateColorShades !== false ) { - options.themes = options.themes.map((theme) => { - theme.colors = { + themes = themes.map((theme) => { + const updatedColors = { ...generateShades( theme.colors, typeof options.generateColorShades !== "boolean" @@ -51,16 +53,16 @@ const generateTheme = (options: { ...theme.colors, }; - return theme; + return { ...theme, colors: updatedColors }; }); } const themeRoot = generateThemeRoot({ - properties: { ...options.themes[0].colors }, + properties: { ...themes[0].colors }, }); - if (options.themes.length > 1) { - const themeOverrides = options.themes + if (themes.length > 1) { + const themeOverrides = themes .slice(1) .map((theme) => { const overrideClass = generateThemeOverrideClass({