Files
vue-ts-example/unocss.config.ts
严浩 a1cf330f9a
Some checks failed
/ build-and-deploy-to-vercel (push) Has been cancelled
/ depcheck (push) Has been cancelled
/ playwright (push) Has been cancelled
feat: 更新 unocss 配置,添加新的颜色变量和文本颜色定义
2025-01-03 18:25:37 +08:00

73 lines
2.0 KiB
TypeScript

// https://github.dev/unocss/unocss/tree/main/examples/vite-vue3
import { defineConfig, presetAttributify, presetUno, transformerDirectives, transformerVariantGroup } from 'unocss';
export default defineConfig({
theme: {
// https://unocss.dev/presets/wind#differences-from-tailwind-css
// https://www.npmjs.com/package/unocss-preset-animations
// https://github.com/whatnickcodes/unocss-preset-tailwindcss-motion
animation: {
keyframes: {
scalein: '{0% { opacity: 0; transform: scaleY(0.8); } 100% { opacity: 1; transform: scaleY(1); }}',
fadeout: '{0% { opacity: 1; } 100% { opacity: 0; }}',
},
durations: {
scalein: '0.15s',
fadeout: '0.15s',
},
timingFns: {
scalein: 'linear',
fadeout: 'linear',
},
properties: {
scalein: {
transition: 'transform 0.12s cubic-bezier(0, 0, 0.2, 1), opacity 0.12s cubic-bezier(0, 0, 0.2, 1)',
},
fadeout: {},
},
counts: {
scalein: '1',
fadeout: '1',
},
},
// https://unocss.dev/config/theme#usage
colors: {
'surface-0': 'var(--p-surface-0)', // text-surface-0
'surface-900': 'var(--p-surface-900)', // text-surface-900
},
},
shortcuts: [
{
'logo-transform': 'i-icon:pacman w-6em h-6em transform transition-800',
pacman: 'i-icon:pacman text-(pink 36)',
},
{
// https://github.com/primefaces/tailwindcss-primeui/blob/d5e903377e015b7c63cb5edf42490b9d6954ef04/src/utils/preset.js
'text-muted-color': 'text-[var(--p-text-muted-color)]',
},
],
presets: [
presetUno({
/* prefix: "u-", */
dark: {
dark: '.app-dark',
},
}),
// https://unocss.dev/presets/attributify
presetAttributify(),
],
transformers: [
//https://unocss.dev/transformers/variant-group
transformerVariantGroup(),
// https://unocss.dev/transformers/directives
transformerDirectives(),
],
});
// text-[var(--h-gray-1)]
// <div class="i-icon:pacman text-(pink 36)" />