2024-01-29 09:26:07 +08:00

18 lines
428 B
JavaScript

export function createTheme(name, componentThemes) {
const nameIsString = typeof name === 'string';
const theme = {
name: nameIsString ? name : 'customized-theme'
};
if (nameIsString) {
if (componentThemes) {
for (const cTheme of componentThemes) {
theme[cTheme.name] = cTheme;
}
}
} else {
for (const cTheme of name) {
theme[cTheme.name] = cTheme;
}
}
return theme;
}