tailwind.config.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. const colors = require('tailwindcss/colors')
  2. function exposeColorsToCssVars ({ addBase, theme }) {
  3. function extractColorVars (colorObj, colorGroup = '') {
  4. return Object.keys(colorObj).reduce((vars, colorKey) => {
  5. const value = colorObj[colorKey]
  6. const newVars =
  7. typeof value === 'string'
  8. ? { [`--color${colorGroup}-${colorKey}`]: value }
  9. : extractColorVars(value, `-${colorKey}`)
  10. return { ...vars, ...newVars }
  11. }, {})
  12. }
  13. addBase({
  14. ':root': extractColorVars(theme('colors')),
  15. })
  16. }
  17. module.exports = {
  18. darkMode: 'class',
  19. content: [
  20. './src/**/*.js',
  21. './src/**/*.cljs',
  22. './resources/**/*.html'
  23. ],
  24. safelist: [
  25. 'bg-black', 'bg-white',
  26. { pattern: /bg-(gray|red|yellow|green|blue|orange|indigo|rose|purple|pink)-(100|200|300|400|500|600|700|800|900)/ },
  27. { pattern: /text-(gray|red|yellow|green|blue|orange|indigo|rose|purple|pink)-(100|200|300|400|500|600|700|800|900)/ }
  28. ],
  29. plugins: [
  30. require('@tailwindcss/forms'),
  31. require('@tailwindcss/typography'),
  32. require('@tailwindcss/aspect-ratio'),
  33. require('@tailwindcss/line-clamp'),
  34. exposeColorsToCssVars
  35. ],
  36. theme: {
  37. extend: {
  38. fontSize: {
  39. '2xs': ['0.625rem', '0.875rem']
  40. },
  41. animation: {
  42. 'spin-reverse': 'spin 2s linear infinite reverse',
  43. },
  44. spacing: {
  45. '128': '32rem',
  46. '144': '36rem'
  47. },
  48. scale: {
  49. '200': '2',
  50. '250': '2.5',
  51. '300': '3',
  52. '400': '4',
  53. }
  54. },
  55. colors: {
  56. transparent: 'transparent',
  57. current: 'currentColor',
  58. black: colors.black,
  59. white: colors.white,
  60. gray: colors.neutral,
  61. green: colors.green,
  62. blue: colors.blue,
  63. indigo: {
  64. 50: '#f0f9ff',
  65. 100: '#e0f2fe',
  66. 200: '#bae6fd',
  67. 300: '#7dd3fc',
  68. 400: '#38bdf8',
  69. 500: '#0ea5e9',
  70. 600: '#0284c7',
  71. 700: '#005b8a',
  72. 800: '#075985',
  73. 900: '#0c4a6e',
  74. },
  75. red: colors.red,
  76. yellow: colors.amber,
  77. orange: colors.orange,
  78. rose: colors.rose,
  79. purple: colors.purple,
  80. pink: colors.pink
  81. }
  82. }
  83. }