forked from melt-ui/melt-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.config.ts
121 lines (117 loc) · 2.54 KB
/
tailwind.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
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
import type { Config } from 'tailwindcss';
import plugin from 'tailwindcss/plugin';
import typography from '@tailwindcss/typography';
/**
* @param name Complete CSS variable name of the color (e.g. `magnum-100`)
* @returns The CSS string to use in a Tailwind config
*/
function getColorFromVariableName(name: string) {
return `rgb(var(--color-${name}) / <alpha-value>)`;
}
/**
* @param name CSS variable name of the colors (e.g. `magnum`)
* @param variants Variants of the color. Default is `[50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]`
* @returns The structured colors object
*/
function getColorsFromName(
name: string,
variants: number[] = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
) {
return Object.fromEntries(
variants.map((n) => [`${n}`, getColorFromVariableName(`${name}-${n}`)])
);
}
export default {
content: ['./src/**/*.{html,js,svelte,ts}'],
darkMode: 'class',
theme: {
container: {
center: true,
padding: '2rem',
screens: {
'2xl': '1540px',
},
},
extend: {
colors: {
magnum: getColorsFromName('magnum'),
neutral: getColorsFromName('neutral'),
zinc: getColorsFromName('zinc'),
green: getColorsFromName('green', [400]),
white: getColorFromVariableName('white'),
},
fontFamily: {
sans: [
'Inter',
'-apple-system',
'BlinkMacSystemFont',
'Segoe UI',
'Roboto',
'Oxygen',
'Ubuntu',
'Cantarell',
'Fira Sans',
'Droid Sans',
'Helvetica Neue',
'Arial',
'sans-serif',
'Apple Color Emoji',
'Segoe UI Emoji',
'Segoe UI Symbol',
],
display: [
'GT Maru',
'Segoe UI',
'Roboto',
'Oxygen',
'Ubuntu',
'Cantarell',
'Fira Sans',
'Droid Sans',
'Helvetica Neue',
'Arial',
'sans-serif',
'Apple Color Emoji',
'Segoe UI Emoji',
'Segoe UI Symbol',
],
mono: [
'GT Maru Mono',
'ui-monospace',
'SFMono-Regular',
'SF Mono',
'Menlo',
'Consolas',
'Liberation Mono',
'monospace',
],
},
typography: (theme) => ({
DEFAULT: {
css: {
code: {
position: 'relative',
borderRadius: theme('borderRadius.md'),
},
},
},
}),
},
},
plugins: [
typography,
plugin(function ({ addVariant, matchUtilities, theme }) {
addVariant('hocus', ['&:hover', '&:focus']);
// Square utility
matchUtilities(
{
square: (value) => ({
width: value,
height: value,
}),
},
{ values: theme('spacing') }
);
}),
],
} satisfies Config;