@abdalla-1/swisco
Version:
Swiscare Components Kit
38 lines (29 loc) • 746 B
text/typescript
import { themeColors } from './tokens/colors';
// Light theme.
export const light = {
...themeColors.light,
};
// Dark theme.
export const dark: BaseTheme = {
...themeColors.dark,
};
// Setup consistent base theme type.
export type BaseTheme = typeof light;
// Light and Dark Theme tokens
const modeThemes = {
light,
dark,
};
const allThemes = {
...modeThemes,
};
// 2. then get the name type
type ThemeName = keyof typeof allThemes;
// 3. then, create a Themes type that explicitly maps ThemeName => BaseTheme
type Themes = {
[key in ThemeName]: BaseTheme;
};
// 4. finally, export it with the stricter type
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
export const themes: Themes = allThemes;