-
Notifications
You must be signed in to change notification settings - Fork 411
/
tailwind.config.js
151 lines (143 loc) · 3.27 KB
/
tailwind.config.js
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
const colors = require('tailwindcss/colors');
const tinycolor2 = require('tinycolor2');
const { themeColors, rabbyCssPrefix } = require('./src/constant/theme-colors');
const rabbyColors = ['light', 'dark'].reduce((accu, theme) => {
Object.entries(themeColors[theme]).forEach(([cssvarKey, colorValue]) => {
// const splitorIdx = cssvarKey.indexOf('-');
// const group = cssvarKey.slice(0, splitorIdx);
// const suffix = cssvarKey.slice(splitorIdx + 1);
const tinyColor = tinycolor2(colorValue);
const alpha = tinyColor.getAlpha();
const hexValue = alpha === 1 ? tinyColor.toHexString() : tinyColor.toHex8String();
if (!accu.auto[cssvarKey]) {
accu.auto[cssvarKey] = `var(--${rabbyCssPrefix}${cssvarKey}, ${hexValue})`;
}
accu[theme][cssvarKey] = hexValue;
});
return accu;
}, {
light: {},
dark: {},
auto: {},
});
/** @type {import('tailwindcss').Config} */
module.exports = {
mode: 'jit',
purge: ['./src/ui/**/*.{ts,tsx,html}'],
theme: {
spacing: [
0,
1,
2,
4,
6,
8,
10,
12,
14,
16,
18,
20,
24,
28,
32,
40,
60,
80,
].reduce((m, n) => {
m[n] = `${n}px`;
return m;
}, {}),
screens: {
sm: { max: '600px' },
lg: { min: '600px' },
},
colors: {
transparent: 'transparent',
current: 'currentColor',
blue: {
from: '#8A78FD',
to: '#796BFD',
light: rabbyColors.light['blue-default'],
DEFAULT: '#796BFD',
purple: '#5F75FF',
},
black: '#707280',
green: '#27C193',
white: colors.white,
yellow: '#F29C1B',
orange: '#FFB020',
pink: '#F24822',
red: {
light: '#F24822',
DEFAULT: '#AF160E',
forbidden: '#EC5151',
},
gray: {
bg2: '#F5F6FA',
bg: '#F5F6FA',
divider: '#E5E9EF',
comment: '#B4BDCC',
content: '#707280',
subTitle: '#4B4D59',
title: '#13141A',
light: '#707880',
common: '#666666',
},
},
fontSize: {
12: [
'12px',
{
lineHeight: '14px',
},
],
13: '13px',
14: [
'14px',
{
lineHeight: '18px',
},
],
15: [
'15px',
{
lineHeight: '18px',
},
],
18: [
'18px',
{
lineHeight: '22px',
},
],
20: '20px',
24: [
'24px',
{
lineHeight: '28px',
},
],
28: [
'28px',
{
lineHeight: '33px',
},
],
},
/** @notice configuration here would override the default config above */
extend: {
colors: {
[`${rabbyCssPrefix.replace(/\-$/, '')}`]: rabbyColors.auto,
[`${'rabby-'.replace(/\-$/, '')}`]: rabbyColors.auto,
[`${'-r-'.replace(/\-$/, '')}`]: rabbyColors.auto,
[`light-${rabbyCssPrefix.replace(/\-$/, '')}`]: rabbyColors.light,
[`dark-${rabbyCssPrefix.replace(/\-$/, '')}`]: rabbyColors.dark,
}
},
},
// use class insteadof media-query prefers-color-scheme
// see https://v2.tailwindcss.com/docs/dark-mode
darkMode: 'class',
important: true,
};