-
Notifications
You must be signed in to change notification settings - Fork 108
/
uno.config.ts
84 lines (78 loc) · 1.99 KB
/
uno.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import type { Theme } from 'unocss/preset-uno'
import presetAttributify from '@unocss/preset-attributify'
import transformerDirectives from '@unocss/transformer-directives'
import {
defineConfig,
presetIcons,
presetTypography,
presetUno,
transformerVariantGroup,
} from 'unocss'
import presetTheme from 'unocss-preset-theme'
import { themeConfig } from './src/.config'
const { colorsDark, colorsLight, fonts } = themeConfig.appearance
const cssExtend = {
':root': {
'--prose-borders': '#eee',
},
'code::before,code::after': {
content: 'none',
},
':where(:not(pre):not(a) > code)': {
'white-space': 'normal',
'word-wrap': 'break-word',
'padding': '2px 4px',
'color': '#c7254e',
'font-size': '90%',
'background-color': '#f9f2f4',
'border-radius': '4px',
},
'li': {
'white-space': 'normal',
'word-wrap': 'break-word',
},
}
export default defineConfig({
rules: [
[
/^row-(\d+)-(\d)$/,
([, start, end]) => ({ 'grid-row': `${start}/${end}` }),
],
[
/^col-(\d+)-(\d)$/,
([, start, end]) => ({ 'grid-column': `${start}/${end}` }),
],
[
/^scrollbar-hide$/,
([_]) => `.scrollbar-hide { scrollbar-width:none;-ms-overflow-style: none; }
.scrollbar-hide::-webkit-scrollbar {display:none;}`,
],
],
presets: [
presetUno(),
presetTypography({ cssExtend }),
presetAttributify(),
presetIcons({ scale: 1.2, warn: true }),
presetTheme<Theme>({
theme: {
dark: {
colors: { ...colorsDark, shadow: '#FFFFFF0A' },
// TODO 需要配置代码块颜色
},
}
}),
],
theme: {
colors: { ...colorsLight, shadow: '#0000000A' },
fontFamily: fonts,
},
shortcuts: [
['post-title', 'text-5 font-bold lh-7.5 m-0'],
],
transformers: [transformerDirectives(), transformerVariantGroup()],
safelist: [
...themeConfig.site.socialLinks.map(social => `i-mdi-${social.name}`),
'i-mdi-content-copy',
'i-mdi-check',
],
})