forked from vaishnav-mk/portfolio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.config.js
93 lines (84 loc) · 2.4 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
const colors = require('tailwindcss/colors')
const toRgba = (hexCode, opacity = 50) => {
let hex = hexCode.replace('#', '')
if (hex.length === 3) {
hex = `${hex[0]}${hex[0]}${hex[1]}${hex[1]}${hex[2]}${hex[2]}`
}
const r = parseInt(hex.substring(0, 2), 16)
const g = parseInt(hex.substring(2, 4), 16)
const b = parseInt(hex.substring(4, 6), 16)
return `rgba(${r},${g},${b},${opacity / 100})`
}
const flattenColorPalette = (obj, sep = '-') =>
Object.assign(
{},
...(function _flatten(o, p = '') {
return [].concat(
...Object.keys(o).map((k) =>
typeof o[k] === 'object'
? _flatten(o[k], k + sep)
: { [p + k]: o[k] },
),
)
})(obj),
)
module.exports = {
mode: 'jit',
content: ['./src/pages/**/*.tsx', './src/components/**/*.tsx'],
darkMode: 'class',
theme: {
fontFamily: {
sans: ['Be Vietnam Pro', 'system-ui', 'sans'],
},
extend: {
colors: {
dark: '#000',
white: '#fff',
lightText: '#76797d',
bgDark: '#2E3440',
cardDark: '#434C5E',
butDark: '#5E81AC',
bgLight: '#D8DEE9',
cardLight: '#E5E9F0',
butLight: '#81A1C1',
defaultGreen: '#36D399',
},
animation: {
bounce200: 'bounce 1s infinite 200ms',
bounce400: 'bounce 1s infinite 400ms',
bounce600: 'bounce 1s infinite 600ms',
},
},
},
variants: {
extend: {},
},
plugins: [
function ({ addUtilities, theme }) {
const utilities = {
'.bg-stripes': {
backgroundImage:
'linear-gradient(45deg, var(--stripes-color) 12.50%, transparent 12.50%, transparent 50%, var(--stripes-color) 50%, var(--stripes-color) 62.50%, transparent 62.50%, transparent 100%)',
backgroundSize: '5.66px 5.66px',
},
}
const addColor = (name, color) =>
(utilities[`.bg-stripes-${name}`] = { '--stripes-color': color })
const colors = flattenColorPalette(theme('backgroundColor'))
for (let name in colors) {
try {
const [r, g, b, a] = toRgba(colors[name])
if (a !== undefined) {
addColor(name, colors[name])
} else {
addColor(name, `rgba(${r}, ${g}, ${b}, 0.4)`)
}
} catch (_) {
addColor(name, colors[name])
}
}
addUtilities(utilities)
},
require('daisyui'),
],
}