-
Notifications
You must be signed in to change notification settings - Fork 35
/
tailwind.config.js
69 lines (66 loc) · 2.21 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
const plugin = require('tailwindcss/plugin')
const themeColorRamps = [
{ name: 'chalkboard', stops: 12 },
{ name: 'energy', stops: 12 },
{ name: 'liquid', stops: 12 },
{ name: 'fern', stops: 12 },
{ name: 'cool', stops: 12 },
{ name: 'river', stops: 12 },
{ name: 'berry', stops: 12 },
{ name: 'destroy', stops: 8 },
{ name: 'warn', stops: 8 },
{ name: 'succeed', stops: 8 },
]
const toOKLCHVar = (val) => `oklch(var(${val}) / <alpha-value>) `
const themeColors = Object.fromEntries(
themeColorRamps.map(({ name, stops }) => [
name,
Object.fromEntries(
new Array(stops)
.fill(0)
.map((_, i) => [(i + 1) * 10, toOKLCHVar(`--_${name}-${(i + 1) * 10}`)])
),
])
)
/** @type {import('tailwindcss').Config} */
module.exports = {
mode: 'jit',
content: ['./src/**/*.{js,jsx,ts,tsx}'],
theme: {
extend: {
colors: {
primary: `oklch(var(--_primary) / <alpha-value>)`,
...themeColors,
},
fontFamily: {
display: `'owners', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif`,
sans: `'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif`,
},
},
},
darkMode: 'class',
plugins: [
require('@headlessui/tailwindcss'),
// custom plugin to add variants for aria-pressed
// To use, just add a class of 'group-pressed:<some-tailwind-class>' or 'pressed:<some-tailwind-class>'
// to your element. Based on https://dev.to/philw_/tying-tailwind-styling-to-aria-attributes-502f
plugin(function ({ addVariant, e }) {
addVariant('group-pressed', ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.group[aria-pressed='true'] .${e(
`group-pressed${separator}${className}`
)}`
})
})
addVariant('pressed', ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `.${e(`pressed${separator}${className}`)}[aria-pressed='true']`
})
})
}),
],
}