Change `palette` method
parent
7b3908908a
commit
9d84a9f92c
|
@ -281,6 +281,9 @@ export default {
|
||||||
$globalThemeOptions() {
|
$globalThemeOptions() {
|
||||||
return this.$globalTheme?.options;
|
return this.$globalTheme?.options;
|
||||||
},
|
},
|
||||||
|
$globalThemeExtend() {
|
||||||
|
return this.$globalTheme?.extend;
|
||||||
|
},
|
||||||
$globalBaseTheme() {
|
$globalBaseTheme() {
|
||||||
return ObjectUtils.getItemValue(this.$globalTheme?.base);
|
return ObjectUtils.getItemValue(this.$globalTheme?.base);
|
||||||
},
|
},
|
||||||
|
@ -329,7 +332,8 @@ export default {
|
||||||
globalTheme: {
|
globalTheme: {
|
||||||
base: { ...this.$globalBaseTheme },
|
base: { ...this.$globalBaseTheme },
|
||||||
preset: { ...this.$globalPresetTheme },
|
preset: { ...this.$globalPresetTheme },
|
||||||
options: { ...this.$globalThemeOptions }
|
options: { ...this.$globalThemeOptions },
|
||||||
|
extend: { ...this.$globalThemeExtend }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import shade from './shade';
|
import shade from './shade';
|
||||||
import tint from './tint';
|
import tint from './tint';
|
||||||
|
|
||||||
export default (color) =>
|
const scales = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
||||||
typeof color === 'string'
|
|
||||||
? Array.from({ length: 10 }).reduce((acc, _, i) => {
|
|
||||||
i <= 5 ? (acc[i === 0 ? '50' : `${i * 100}`] = tint(color, (5 - i) * 19)) : (acc[`${i * 100}`] = shade(color, (i - 5) * 15));
|
|
||||||
|
|
||||||
return acc;
|
export default (color) => {
|
||||||
}, {})
|
if (/{([^}]*)}/g.test(color)) {
|
||||||
: color;
|
const token = color.replace(/{|}/g, '');
|
||||||
|
|
||||||
|
return scales.reduce((acc, scale) => ((acc[scale] = `{${token}.${scale}}`), acc), {});
|
||||||
|
}
|
||||||
|
|
||||||
|
return typeof color === 'string' ? scales.reduce((acc, scale, i) => ((acc[scale] = i <= 5 ? tint(color, (5 - i) * 19) : shade(color, (i - 5) * 15)), acc), {}) : color;
|
||||||
|
};
|
||||||
|
|
|
@ -260,6 +260,7 @@ const THEME_ALIAS = {
|
||||||
'primevue/themes/primeone/aura': path.resolve(__dirname, './components/lib/themes/primeone/aura/index.js'),
|
'primevue/themes/primeone/aura': path.resolve(__dirname, './components/lib/themes/primeone/aura/index.js'),
|
||||||
'primevue/themes/primeone': path.resolve(__dirname, './components/lib/themes/primeone/index.js'),
|
'primevue/themes/primeone': path.resolve(__dirname, './components/lib/themes/primeone/index.js'),
|
||||||
'primevue/themes/config': path.resolve(__dirname, './components/lib/themes/config/index.js'),
|
'primevue/themes/config': path.resolve(__dirname, './components/lib/themes/config/index.js'),
|
||||||
|
'primevue/themes/utils': path.resolve(__dirname, './components/lib/themes/utils/index.js'),
|
||||||
'primevue/themes': path.resolve(__dirname, './components/lib/themes/index.js')
|
'primevue/themes': path.resolve(__dirname, './components/lib/themes/index.js')
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue