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:
Li Kui
2024-08-07 21:28:25 +08:00
committed by GitHub
parent 861f39b519
commit 1d38fb647e
13 changed files with 871 additions and 1080 deletions

View File

@@ -9,7 +9,7 @@ import {
BUILT_IN_THEME_PRESETS,
type BuiltinThemePreset,
} from '@vben/preferences';
import { convertToHsl, TinyColor } from '@vben/utils';
import { Color, convertToHsl } from '@vben/utils';
defineOptions({
name: 'PreferenceBuiltinTheme',
@@ -22,17 +22,11 @@ const modelValue = defineModel<BuiltinThemeType>({ default: 'default' });
const themeColorPrimary = defineModel<string>('themeColorPrimary');
const inputValue = computed(() => {
return new TinyColor(themeColorPrimary.value).toHexString();
return new Color(themeColorPrimary.value || '').toHexString();
});
const builtinThemePresets = computed(() => {
return [
// {
// color: 'hsl(231 98% 65%)',
// type: 'default',
// },
...BUILT_IN_THEME_PRESETS,
];
return [...BUILT_IN_THEME_PRESETS];
});
function typeView(name: BuiltinThemeType) {