-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtailwind.config.js
104 lines (97 loc) · 3.69 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
const plugin = require('tailwindcss/plugin')
module.exports = {
mode: ['jit'],
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
darkMode: 'class',
theme: {
extend: {
fontFamily: {
lato: ['Lato', 'sans-serif'],
},
fontSize: {},
screens: {
'mobile': '320px',
},
},
},
plugins: [
plugin(function ({ addUtilities, matchUtilities, theme }) {
const scrollbarTrackColorValue = (value) => ({
'--scrollbar-track': value,
'&::-webkit-scrollbar-track': {
'background-color': value,
},
})
const scrollbarTrackRoundedValue = (value) => ({
'&::-webkit-scrollbar-track': {
'border-radius': value,
},
})
const scrollbarThumbColorValue = (value) => ({
'--scrollbar-thumb': value,
'&::-webkit-scrollbar-thumb': {
'background-color': value,
},
})
const scrollbarThumbRoundedValue = (value) => ({
'&::-webkit-scrollbar-thumb': {
'border-radius': value,
},
})
addUtilities({
'.scrollbar': {
'--scrollbar-thumb': '#cdcdcd',
'--scrollbar-track': '#f0f0f0',
'--scrollbar-width': '16px',
'--scrollbar-height': '16px',
'scrollbar-color': 'var(--scrollbar-thumb) var(--scrollbar-track)',
'&::-webkit-scrollbar': {
width: 'var(--scrollbar-width)',
height: 'var(--scrollbar-height)',
},
},
'.scrollbar-thin': {
'--scrollbar-width': '8px',
'--scrollbar-height': '8px',
'scrollbar-width': 'thin',
},
})
Object.entries(theme('colors')).forEach(([colorName, color]) => {
switch (typeof color) {
case 'object':
matchUtilities(
{
[`scrollbar-track-${colorName}`]: (value) => scrollbarTrackColorValue(value),
[`scrollbar-thumb-${colorName}`]: (value) => scrollbarThumbColorValue(value),
},
{
values: color,
}
)
break
case 'function':
addUtilities({
[`.scrollbar-track-${colorName}`]: scrollbarTrackColorValue(color({})),
[`.scrollbar-thumb-${colorName}`]: scrollbarThumbColorValue(color({})),
})
break
case 'string':
addUtilities({
[`.scrollbar-track-${colorName}`]: scrollbarTrackColorValue(color),
[`.scrollbar-thumb-${colorName}`]: scrollbarThumbColorValue(color),
})
break
}
})
matchUtilities(
{
'scrollbar-track-rounded': (value) => scrollbarTrackRoundedValue(value),
'scrollbar-thumb-rounded': (value) => scrollbarThumbRoundedValue(value),
},
{
values: theme('borderRadius'),
}
)
}),
],
}