Commit c26dd034165b02d107977fdfe13471ea80e991cc
Committed by
GitHub
1 parent
336be680
fix(theme generate): Fix #604 (#605)
fix(theme generate): Fix #604
Showing
1 changed file
with
7 additions
and
5 deletions
build/config/themeConfig.ts
... | ... | @@ -6,6 +6,8 @@ export const darkMode = 'light'; |
6 | 6 | |
7 | 7 | type Fn = (...arg: any) => any; |
8 | 8 | |
9 | +type GenerateTheme = 'default' | 'dark' | |
10 | + | |
9 | 11 | export interface GenerateColorsParams { |
10 | 12 | mixLighten: Fn; |
11 | 13 | mixDarken: Fn; |
... | ... | @@ -13,19 +15,19 @@ export interface GenerateColorsParams { |
13 | 15 | color?: string; |
14 | 16 | } |
15 | 17 | |
16 | -export function generateAntColors(color: string) { | |
18 | +export function generateAntColors(color: string, theme: GenerateTheme = 'default') { | |
17 | 19 | return generate(color, { |
18 | - theme: 'default', | |
20 | + theme | |
19 | 21 | }); |
20 | 22 | } |
21 | 23 | |
22 | 24 | export function getThemeColors(color?: string) { |
23 | 25 | const tc = color || primaryColor; |
24 | - const colors = generateAntColors(tc); | |
26 | + const lightColors = generateAntColors(tc); | |
25 | 27 | const primary = colors[5]; |
26 | - const modeColors = generateAntColors(primary); | |
28 | + const modeColors = generateAntColors(primary, 'dark'); | |
27 | 29 | |
28 | - return [...colors, ...modeColors]; | |
30 | + return [...lightColors, ...modeColors]; | |
29 | 31 | } |
30 | 32 | |
31 | 33 | export function generateColors({ | ... | ... |