soapbox/tailwind.config.js

81 wiersze
2.1 KiB
JavaScript
Czysty Zwykły widok Historia

2022-03-07 22:54:45 +00:00
// https://tailwindcss.com/docs/customizing-colors#using-css-variables
function withOpacityValue(variable) {
return ({ opacityValue }) => {
if (opacityValue === undefined) {
return `rgb(var(${variable}))`;
}
return `rgb(var(${variable}) / ${opacityValue})`;
};
}
// Parse list of shades into Tailwind function with CSS variables
const parseShades = (color, shades) => {
return shades.reduce((obj, shade) => {
obj[shade] = withOpacityValue(`--color-${color}-${shade}`);
return obj;
}, {});
};
// Parse color matrix into Tailwind colors object
const parseColors = colors => {
return Object.keys(colors).reduce((obj, color) => {
obj[color] = parseShades(color, colors[color]);
return obj;
}, {});
};
// Define color matrix (of available colors)
const colors = {
gray: [50, 100, 200, 300, 400, 500, 600, 700, 800, 900],
primary: [50, 100, 200, 300, 400, 500, 600, 700, 800, 900],
success: [50, 100, 200, 300, 400, 500, 600, 700, 800, 900],
danger: [50, 100, 200, 300, 400, 500, 600, 700, 800, 900],
accent: [300, 500],
};
2022-03-19 18:20:00 +00:00
module.exports = {
content: ['./app/**/*.{html,js,ts,tsx}'],
darkMode: 'class',
theme: {
screens: {
sm: '581px',
md: '768px',
lg: '976px',
xl: '1440px',
},
extend: {
fontSize: {
base: '0.9375rem',
},
fontFamily: {
'sans': [
'Inter',
'ui-sans-serif',
'system-ui',
'-apple-system',
'BlinkMacSystemFont',
'Segoe UI',
'Roboto',
'Helvetica Neue',
'Arial',
'Noto Sans',
'sans-serif',
'Apple Color Emoji',
'Segoe UI Emoji',
'Segoe UI Symbol',
'Noto Color Emoji',
],
},
2022-03-07 22:54:45 +00:00
colors: Object.assign(parseColors(colors), {
'gradient-purple': withOpacityValue('--color-gradient-purple'),
'gradient-blue': withOpacityValue('--color-gradient-blue'),
'sea-blue': withOpacityValue('--color-sea-blue'),
}),
2022-03-19 18:20:00 +00:00
},
},
plugins: [
require('@tailwindcss/forms'),
require('@tailwindcss/typography'),
],
};