satupeta-main/shared/utils/create-theme.ts

26 lines
584 B
TypeScript
Raw Normal View History

2026-01-27 02:31:12 +00:00
type ThemeInput = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
colors: Record<string, any>;
borderRadius: Record<string, string>;
fontSizes: Record<string, string>;
};
export function createTheme(theme: ThemeInput) {
return {
...theme,
getColor: (key: string) => {
// Example utility function
const keys = key.split(".");
let color = theme.colors;
for (const k of keys) {
if (color[k]) {
color = color[k];
} else {
return undefined;
}
}
return color;
},
};
}