tailwind.config.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. { pattern: /columns-([1-9]|1[0-2])|(auto|3xs|2xs|xs|sm|md|lg|xl)|([2-7]xl)/ }
  29. ],
  30. plugins: [
  31. require('@tailwindcss/forms'),
  32. require('@tailwindcss/typography'),
  33. require('@tailwindcss/aspect-ratio'),
  34. require('@tailwindcss/line-clamp'),
  35. exposeColorsToCssVars
  36. ],
  37. theme: {
  38. extend: {
  39. fontSize: {
  40. '2xs': ['0.625rem', '0.875rem']
  41. },
  42. animation: {
  43. 'spin-reverse': 'spin 2s linear infinite reverse',
  44. },
  45. spacing: {
  46. '128': '32rem',
  47. '144': '36rem'
  48. },
  49. scale: {
  50. '200': '2',
  51. '250': '2.5',
  52. '300': '3',
  53. '400': '4',
  54. }
  55. },
  56. colors: {
  57. transparent: 'transparent',
  58. current: 'currentColor',
  59. black: colors.black,
  60. white: colors.white,
  61. gray: colors.neutral,
  62. green: colors.green,
  63. blue: colors.blue,
  64. indigo: {
  65. 50: '#f0f9ff',
  66. 100: '#e0f2fe',
  67. 200: '#bae6fd',
  68. 300: '#7dd3fc',
  69. 400: '#38bdf8',
  70. 500: '#0ea5e9',
  71. 600: '#0284c7',
  72. 700: '#005b8a',
  73. 800: '#075985',
  74. 900: '#0c4a6e',
  75. },
  76. red: colors.red,
  77. yellow: colors.amber,
  78. orange: colors.orange,
  79. rose: colors.rose,
  80. purple: colors.purple,
  81. pink: colors.pink
  82. }
  83. }
  84. }