fix(theme generate): Fix #604 (#605)

fix(theme generate): Fix #604
This commit is contained in:
江麻妞 2021-05-17 09:31:15 +08:00 committed by GitHub
parent 336be680d3
commit c26dd03416
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,8 @@ export const darkMode = 'light';
type Fn = (...arg: any) => any;
type GenerateTheme = 'default' | 'dark'
export interface GenerateColorsParams {
mixLighten: Fn;
mixDarken: Fn;
@ -13,19 +15,19 @@ export interface GenerateColorsParams {
color?: string;
}
export function generateAntColors(color: string) {
export function generateAntColors(color: string, theme: GenerateTheme = 'default') {
return generate(color, {
theme: 'default',
theme
});
}
export function getThemeColors(color?: string) {
const tc = color || primaryColor;
const colors = generateAntColors(tc);
const lightColors = generateAntColors(tc);
const primary = colors[5];
const modeColors = generateAntColors(primary);
const modeColors = generateAntColors(primary, 'dark');
return [...colors, ...modeColors];
return [...lightColors, ...modeColors];
}
export function generateColors({