From c26dd034165b02d107977fdfe13471ea80e991cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E9=BA=BB=E5=A6=9E?= <50100681+jiangmaniu@users.noreply.github.com> Date: Mon, 17 May 2021 09:31:15 +0800 Subject: [PATCH] fix(theme generate): Fix #604 (#605) fix(theme generate): Fix #604 --- build/config/themeConfig.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/build/config/themeConfig.ts b/build/config/themeConfig.ts index 880672b6..a693edf2 100644 --- a/build/config/themeConfig.ts +++ b/build/config/themeConfig.ts @@ -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({