Skip to content

Commit

Permalink
feat:support custom component theme
Browse files Browse the repository at this point in the history
  • Loading branch information
kirklin committed Jul 19, 2023
1 parent cdebe37 commit 7e96552
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/admin/src/layouts/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defineOptions({
<Header />
</header>
<div class="block flex-1 overflow-x-hidden rounded-2xl pl-0 pr-5 pt-0 pb-6">
<div class="min-h-full w-full rounded-2xl bg-gray-100 p-4 dark:bg-gray-900">
<div class="min-h-full w-full rounded-2xl bg-gray-100 p-4 dark:bg-gray-9">
<Content />
</div>
</div>
Expand Down
17 changes: 13 additions & 4 deletions apps/admin/src/store/modules/design/themeUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ButtonColorScene, ColorAction, ColorType, ColorTypeCase, ThemeColor, ThemeConfig } from "@celeris/types";
import { generateColorPalettes } from "@celeris/utils";
import { deepMerge, generateColorPalettes } from "@celeris/utils";
import { type GlobalThemeOverrides, commonDark, commonLight } from "naive-ui";

/**
Expand Down Expand Up @@ -116,7 +116,16 @@ export function getThemeColors(
function getTextColor(darkMode: boolean): string {
return darkMode ? commonDark.textColor2 : commonLight.baseColor;
}

function getOtherTheme(darkMode: boolean): GlobalThemeOverrides {

Check warning on line 119 in apps/admin/src/store/modules/design/themeUtils.ts

View workflow job for this annotation

GitHub Actions / LINT

'darkMode' is defined but never used. Allowed unused args must match /^_/u
return {
common: {
borderRadius: "0.5rem",
},
Card: {
borderRadius: "1rem",
},
};
}
/**
* 获取Naive UI自定义主题配置
*
Expand All @@ -129,10 +138,10 @@ export function getNaiveUICustomTheme(
darkMode: boolean,
): GlobalThemeOverrides {
const themeColors = getThemeColors(config, darkMode);
return {
return deepMerge({
common: {
...themeColors,
},
...getOtherColor(config, darkMode),
};
}, getOtherTheme(darkMode));
}

2 comments on commit 7e96552

@vercel
Copy link

@vercel vercel bot commented on 7e96552 Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

celeris-web-api – ./services/admin

celeris-web-api.vercel.app
celeris-web-api-git-master-kirklin.vercel.app
celeris-web-api-kirklin.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 7e96552 Jul 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

celeris-web – ./apps/admin

celeris-web-git-master-kirklin.vercel.app
celeris-web.vercel.app
celeris-web-kirklin.vercel.app

Please sign in to comment.