1 Star 0 Fork 592

bianeh / basic

forked from Fantastic-admin / basic 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
uno.config.ts 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
Hooray 提交于 2023-10-29 23:17 . feat: v4.0
import type { Theme } from 'unocss/preset-uno'
import {
defineConfig,
presetAttributify,
presetIcons,
presetTypography,
presetUno,
transformerCompileClass,
transformerDirectives,
transformerVariantGroup,
} from 'unocss'
import { entriesToCss, toArray } from '@unocss/core'
import { darkTheme, lightTheme } from './themes'
export default defineConfig<Theme>({
shortcuts: [
{
'flex-center': 'flex justify-center items-center',
'flex-col-center': 'flex flex-col justify-center items-center',
},
],
preflights: [
{
getCSS: () => {
const returnCss: any = []
// 明亮主题
const lightCss = entriesToCss(Object.entries(lightTheme))
const lightRoots = toArray([`*,::before,::after`, `::backdrop`])
returnCss.push(lightRoots.map(root => `${root}{${lightCss}}`).join(''))
// 暗黑主题
const darkCss = entriesToCss(Object.entries(darkTheme))
const darkRoots = toArray([`html.dark,html.dark *,html.dark ::before,html.dark ::after`, `html.dark ::backdrop`])
returnCss.push(darkRoots.map(root => `${root}{${darkCss}}`).join(''))
return returnCss.join('')
},
},
],
theme: {
colors: {
'ui-primary': 'rgb(var(--ui-primary))',
'ui-text': 'rgb(var(--ui-text))',
},
},
presets: [
presetUno(),
presetAttributify(),
presetIcons({
extraProperties: {
'display': 'inline-block',
'vertical-align': 'middle',
},
}),
presetTypography(),
],
transformers: [
transformerDirectives(),
transformerVariantGroup(),
transformerCompileClass(),
],
configDeps: [
'themes/index.ts',
],
})
JavaScript
1
https://gitee.com/beh/basic.git
git@gitee.com:beh/basic.git
beh
basic
basic
main

搜索帮助