tailwind.config.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /** @type {import('tailwindcss').Config} */
  2. const defaultTheme = require("tailwindcss/defaultTheme");
  3. const {
  4. default: flattenColorPalette,
  5. } = require("tailwindcss/lib/util/flattenColorPalette");
  6. module.exports = {
  7. // experimental: {
  8. // optimizeUniversalDefaults: true,
  9. // },
  10. content: [
  11. "./pages/**/*.{js,ts,jsx,tsx}",
  12. "./src/**/*.{js,ts,jsx,tsx}",
  13. "./components/**/*.{js,ts,jsx,tsx}",
  14. ],
  15. darkMode: "class",
  16. theme: {
  17. // `demo-*` screens are used for the "mobile-first" responsive demo
  18. screens: {
  19. sm: "640px",
  20. "demo-sm": "720px",
  21. md: "768px",
  22. lg: "1024px",
  23. xl: "1280px",
  24. "2xl": "1536px",
  25. },
  26. aspectRatio: {
  27. auto: "auto",
  28. square: "1 / 1",
  29. video: "16 / 9",
  30. 1: "1",
  31. 2: "2",
  32. 3: "3",
  33. 4: "4",
  34. 5: "5",
  35. 6: "6",
  36. 7: "7",
  37. 8: "8",
  38. 9: "9",
  39. 10: "10",
  40. 11: "11",
  41. 12: "12",
  42. 13: "13",
  43. 14: "14",
  44. 15: "15",
  45. 16: "16",
  46. },
  47. extend: {
  48. fontFamily: {
  49. sans: [
  50. "Nunito Sans",
  51. "SF Pro Text",
  52. "SF Pro Icons",
  53. "Inter var",
  54. ...defaultTheme.fontFamily.sans,
  55. ],
  56. serif: ["Merriweather", ...defaultTheme.fontFamily.serif],
  57. mono: ["Fira Code VF", ...defaultTheme.fontFamily.mono],
  58. source: ["Source Sans Pro", ...defaultTheme.fontFamily.sans],
  59. "ubuntu-mono": ["Ubuntu Mono", ...defaultTheme.fontFamily.mono],
  60. },
  61. },
  62. },
  63. plugins: [
  64. // require("daisyui"),
  65. require("@tailwindcss/line-clamp"),
  66. require("@tailwindcss/typography"),
  67. require("@tailwindcss/aspect-ratio"),
  68. require("@tailwindcss/forms")({ strategy: "class" }),
  69. function ({ addVariant }) {
  70. addVariant(
  71. "supports-backdrop-blur",
  72. "@supports (backdrop-filter: blur(0)) or (-webkit-backdrop-filter: blur(0))"
  73. );
  74. addVariant(
  75. "supports-scrollbars",
  76. "@supports selector(::-webkit-scrollbar)"
  77. );
  78. addVariant("children", "& > *");
  79. addVariant("scrollbar", "&::-webkit-scrollbar");
  80. addVariant("scrollbar-track", "&::-webkit-scrollbar-track");
  81. addVariant("scrollbar-thumb", "&::-webkit-scrollbar-thumb");
  82. },
  83. function ({ matchUtilities, theme }) {
  84. matchUtilities(
  85. {
  86. highlight: (value) => ({ boxShadow: `inset 0 1px 0 0 ${value}` }),
  87. },
  88. { values: flattenColorPalette(theme("backgroundColor")), type: "color" }
  89. );
  90. },
  91. function ({ addUtilities, theme }) {
  92. let backgroundSize = "7.07px 7.07px";
  93. let backgroundImage = (color) =>
  94. `linear-gradient(135deg, ${color} 10%, transparent 10%, transparent 50%, ${color} 50%, ${color} 60%, transparent 60%, transparent 100%)`;
  95. let colors = Object.entries(theme("backgroundColor")).filter(
  96. ([, value]) => typeof value === "object" && value[400] && value[500]
  97. );
  98. addUtilities(
  99. Object.fromEntries(
  100. colors.map(([name, colors]) => {
  101. let backgroundColor = colors[400] + "1a"; // 10% opacity
  102. let stripeColor = colors[500] + "80"; // 50% opacity
  103. return [
  104. `.bg-stripes-${name}`,
  105. {
  106. backgroundColor,
  107. backgroundImage: backgroundImage(stripeColor),
  108. backgroundSize,
  109. },
  110. ];
  111. })
  112. )
  113. );
  114. addUtilities({
  115. ".bg-stripes-white": {
  116. backgroundImage: backgroundImage("rgba(255 255 255 / 0.75)"),
  117. backgroundSize,
  118. },
  119. });
  120. addUtilities({
  121. ".ligatures-none": {
  122. fontVariantLigatures: "none",
  123. },
  124. });
  125. },
  126. ],
  127. };