mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-26 08:36:19 +08:00
refactor: use @ant-design/fast-color instead (#4070)
* refactor: Use @ant-design/fast-color instead * fix: test failed * chore: remove isValidColor All FastColor objects are valid. So isValid is always true. FastColor("not-a-color") -> `#000000` * refactor: rename directory `colorful` to `color` * fix: ci fail
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { reactive, watch } from 'vue';
|
||||
|
||||
import { preferences } from '@vben/preferences';
|
||||
import { hlsStringToRGBString, updateCSSVariables } from '@vben/utils';
|
||||
import { convertToRgb, updateCSSVariables } from '@vben/utils';
|
||||
|
||||
/**
|
||||
* 用于适配各个框架的设计系统
|
||||
@@ -102,7 +102,7 @@ export function useNaiveDesignTokens() {
|
||||
|
||||
const getCssVariableValue = (variable: string, isColor: boolean = true) => {
|
||||
const value = rootStyles.getPropertyValue(variable);
|
||||
return isColor ? hlsStringToRGBString(value) : value;
|
||||
return isColor ? convertToRgb(`hsl(${value})`) : value;
|
||||
};
|
||||
|
||||
watch(
|
||||
@@ -145,8 +145,6 @@ export function useNaiveDesignTokens() {
|
||||
commonTokens.invertedColor = getCssVariableValue('--background-deep');
|
||||
|
||||
commonTokens.borderRadius = getCssVariableValue('--radius', false);
|
||||
|
||||
// antDesignTokens.colorBgMask = getCssVariableValue('--overlay');
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
@@ -160,7 +158,7 @@ export function useElementPlusDesignTokens() {
|
||||
|
||||
const getCssVariableValue = (variable: string, isColor: boolean = true) => {
|
||||
const value = rootStyles.getPropertyValue(variable);
|
||||
return isColor ? `hsl(${value})` : value;
|
||||
return isColor ? convertToRgb(`hsl(${value})`) : value;
|
||||
};
|
||||
watch(
|
||||
() => preferences.theme,
|
||||
|
Reference in New Issue
Block a user