|
|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
import type { BuiltinThemePreset } from '@vben/preferences';
|
|
|
|
|
import type { BuiltinThemeType } from '@vben/types';
|
|
|
|
|
|
|
|
|
|
import { computed, ref } from 'vue';
|
|
|
|
|
import { computed, ref, watch } from 'vue';
|
|
|
|
|
|
|
|
|
|
import { UserRoundPen } from '@vben/icons';
|
|
|
|
|
import { $t } from '@vben/locales';
|
|
|
|
|
@ -80,11 +80,6 @@ function typeView(name: BuiltinThemeType) {
|
|
|
|
|
|
|
|
|
|
function handleSelect(theme: BuiltinThemePreset) {
|
|
|
|
|
modelValue.value = theme.type;
|
|
|
|
|
const primaryColor = props.isDark
|
|
|
|
|
? theme.darkPrimaryColor || theme.primaryColor
|
|
|
|
|
: theme.primaryColor;
|
|
|
|
|
|
|
|
|
|
themeColorPrimary.value = primaryColor || theme.color;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleInputChange(e: Event) {
|
|
|
|
|
@ -95,6 +90,22 @@ function handleInputChange(e: Event) {
|
|
|
|
|
function selectColor() {
|
|
|
|
|
colorInput.value?.[0]?.click?.();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => [modelValue.value, props.isDark] as [BuiltinThemeType, boolean],
|
|
|
|
|
([themeType, isDark]) => {
|
|
|
|
|
const theme = builtinThemePresets.value.find(
|
|
|
|
|
(item) => item.type === themeType,
|
|
|
|
|
);
|
|
|
|
|
if (theme) {
|
|
|
|
|
const primaryColor = isDark
|
|
|
|
|
? theme.darkPrimaryColor || theme.primaryColor
|
|
|
|
|
: theme.primaryColor;
|
|
|
|
|
|
|
|
|
|
themeColorPrimary.value = primaryColor || theme.color;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|