From 5d1eb3cb3c61b288361c40940fcc71ff13c12796 Mon Sep 17 00:00:00 2001 From: chansee97 Date: Mon, 15 Apr 2024 16:08:14 +0800 Subject: [PATCH] chore: color lib change to colord --- package.json | 3 +-- src/store/app/index.ts | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 17d7732..d69f0d8 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "@tinymce/tinymce-vue": "^5.1.1", "@vueuse/core": "^10.9.0", "alova": "^2.19.0", - "chroma-js": "^2.4.2", + "colord": "^2.9.3", "echarts": "^5.5.0", "md-editor-v3": "^4.11.3", "performant-array-to-tree": "^1.11.0", @@ -70,7 +70,6 @@ "@antfu/eslint-config": "^2.13.3", "@iconify-json/icon-park-outline": "^1.1.15", "@iconify/vue": "^4.1.1", - "@types/chroma-js": "^2.4.4", "@types/node": "^20.12.7", "@types/qs": "^6.9.14", "@vitejs/plugin-vue": "^5.0.4", diff --git a/src/store/app/index.ts b/src/store/app/index.ts index 0d2ff9c..95702ae 100644 --- a/src/store/app/index.ts +++ b/src/store/app/index.ts @@ -1,5 +1,5 @@ import type { GlobalThemeOverrides } from 'naive-ui' -import chroma from 'chroma-js' +import { colord } from 'colord' import { set } from 'radash' import themeConfig from './theme.json' import { local, setLocale } from '@/utils' @@ -74,8 +74,8 @@ export const useAppStore = defineStore('app-store', { }, /* 设置主题色 */ setPrimaryColor(color: string) { - const brightenColor = chroma(color).brighten(1).hex() - const darkenColor = chroma(color).darken(1).hex() + const brightenColor = colord(color).lighten(0.1).toHex() + const darkenColor = colord(color).darken(0.05).toHex() set(this.theme, 'common.primaryColor', color) set(this.theme, 'common.primaryColorHover', brightenColor) set(this.theme, 'common.primaryColorPressed', darkenColor)