forked from bancorprotocol/carbon-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.config.ts
170 lines (166 loc) · 4.67 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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import type { Config } from 'tailwindcss';
import { formatRgb } from 'culori';
function createTwConfigValues(start: number, end: number, step: number) {
const remBase = 16;
const obj = {};
for (let i = start; i <= end; i = i + step) {
obj[i] = `${i / remBase}rem`;
}
return obj;
}
const oklch = (l: number, c: number, h: number) => {
const result = formatRgb(`oklch(${l} ${c} ${h} / 0)`);
return result.replace(', 0)', ', <alpha-value>)');
};
const lighten = (l: number, amount: number) => Math.min(l + amount, 1);
const darken = (l: number, amount: number) => Math.max(l - amount, 0);
const lightDark = (l: number, c: number, h: number) => ({
light: oklch(lighten(l, 0.2), c, h),
DEFAULT: oklch(l, c, h),
dark: oklch(darken(l, 0.5), c, h),
});
export default {
content: ['./src/**/*.{js,jsx,ts,tsx}'],
theme: {
screens: {
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
'2xl': '1536px',
},
colors: ({ colors }) => {
// Background color variables
const hue = 0;
const chroma = 0; // Recommended 0.01, 0.02
return {
background: {
50: oklch(0.99, chroma, hue),
100: oklch(0.97, chroma, hue),
200: oklch(0.92, chroma, hue),
300: oklch(0.87, chroma, hue),
400: oklch(0.72, chroma, hue),
500: oklch(0.56, chroma, hue),
600: oklch(0.44, chroma, hue),
700: oklch(0.37, chroma, hue),
800: oklch(0.27, chroma, hue),
900: oklch(0.2, chroma, hue),
},
white: colors.white,
transparent: colors.transparent,
primary: lightDark(0.68, 0.153, 160), // #00B578
error: lightDark(0.65, 0.147, 15), // #D86371
sell: lightDark(0.65, 0.147, 15), // #D86371
buy: lightDark(0.68, 0.153, 160), // #00B578
success: lightDark(0.68, 0.153, 160), // #00B578
warning: lightDark(0.747, 0.18, 57.36), // #ff8a00
black: oklch(0.13, chroma, hue),
};
},
spacing: createTwConfigValues(0, 100, 1),
animation: {
none: 'none',
spin: 'spin 1s linear infinite',
ping: 'ping 1s cubic-bezier(0, 0, 0.2, 1) infinite',
pulse: 'pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite',
bounce: 'bounce 1s infinite',
slideUp:
'fade 0.4s cubic-bezier(0.16, 1, 0.3, 1) both, translateY 0.4s cubic-bezier(0.16, 1, 0.3, 1) both',
},
borderColor: ({ theme }) => ({
...theme('colors'),
DEFAULT: theme('colors.gray.200', 'currentColor'),
}),
borderRadius: {
...createTwConfigValues(0, 50, 2),
DEFAULT: '16px',
full: '9999px',
},
fontFamily: {
text: ['Carbon-Text', 'sans-serif'],
title: ['Carbon-Title', 'sans-serif'],
},
fontSize: {
10: ['0.625rem', { lineHeight: '0.875rem' }],
12: ['0.75rem', { lineHeight: '1rem' }],
14: ['0.875rem', { lineHeight: '1.25rem' }],
16: ['1rem', { lineHeight: '1.5rem' }],
18: ['1.125rem', { lineHeight: '1.75rem' }],
20: ['1.25rem', { lineHeight: '1.75rem' }],
24: ['1.5rem', { lineHeight: '2rem' }],
30: ['1.875rem', { lineHeight: '2.25rem' }],
36: ['2.25rem', { lineHeight: '2.5rem' }],
},
fontWeight: {
'weight-100': '100',
'weight-200': '200',
'weight-300': '300',
'weight-400': '400',
'weight-500': '500',
'weight-600': '600',
'weight-700': '700',
'weight-800': '800',
'weight-900': '900',
},
keyframes: {
spin: {
to: {
transform: 'rotate(360deg)',
},
},
ping: {
'75%, 100%': {
transform: 'scale(2)',
opacity: '0',
},
},
pulse: {
'50%': {
opacity: '.5',
},
},
bounce: {
'0%, 100%': {
transform: 'translateY(-25%)',
animationTimingFunction: 'cubic-bezier(0.8,0,1,1)',
},
'50%': {
transform: 'none',
animationTimingFunction: 'cubic-bezier(0,0,0.2,1)',
},
},
fade: {
from: {
opacity: '0',
},
},
translateY: {
from: {
transform: 'translateY(100%)',
},
},
},
maxWidth: ({ theme, breakpoints }) => ({
none: 'none',
0: '0rem',
xs: '20rem',
sm: '24rem',
md: '28rem',
lg: '32rem',
xl: '36rem',
'2xl': '42rem',
'3xl': '48rem',
'4xl': '56rem',
'5xl': '64rem',
'6xl': '72rem',
'7xl': '80rem',
full: '100%',
min: 'min-content',
max: 'max-content',
fit: 'fit-content',
prose: '65ch',
...breakpoints(theme('screens')),
}),
},
plugins: [],
} satisfies Config;