tailwind.config.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. const plugin = require("tailwindcss/plugin")
  2. const defaultTheme = require("tailwindcss/defaultTheme")
  3. function rem(px) {
  4. return `${px / 16}rem`
  5. }
  6. /** @type {import('tailwindcss').Config} */
  7. const config = {
  8. content: [
  9. "./pages/**/*.{js,ts,jsx,tsx}",
  10. "./components/**/*.{js,ts,jsx,tsx}",
  11. ],
  12. theme: {
  13. fontSize: {
  14. h1: rem(68),
  15. h2: rem(50),
  16. h3: rem(42),
  17. h4: rem(38),
  18. h5: rem(28),
  19. h6: rem(22),
  20. sh1: rem(22),
  21. b1: rem(20),
  22. b2: rem(16),
  23. b3: rem(14),
  24. b4: rem(12),
  25. c2: rem(9),
  26. c3: rem(6),
  27. },
  28. lineHeight: {
  29. h1: "calc(75 / 68)",
  30. h2: "calc(55 / 50)",
  31. h3: "calc(55 / 42)",
  32. h4: "calc(50 / 38)",
  33. h5: "calc(38 / 28)",
  34. h6: "calc(30 / 22)",
  35. sh1: "calc(30 / 22)",
  36. b1: "calc(30 / 20)",
  37. b2: "calc(24 / 16)",
  38. b3: "calc(17 / 14)",
  39. b4: "calc(17 / 12)",
  40. c2: "calc(19 / 9)",
  41. c3: "calc(17 / 6)",
  42. },
  43. colors: {
  44. black: "#000000",
  45. gray: {
  46. 0: "#333333",
  47. 1: "#555555",
  48. 2: "#9b9b9b",
  49. 3: "#d4d4d4",
  50. 4: "#f3f3f3",
  51. 5: "#f6f6f6",
  52. },
  53. white: "#ffffff",
  54. nightshade: {
  55. 50: "#fcefff",
  56. 100: "#BD8DC8",
  57. 300: "#834491",
  58. 600: "#4E155A",
  59. 900: "#1d0023", // "main"
  60. },
  61. eggplant: "#17063b",
  62. blurple: {
  63. 300: "#858afa",
  64. 500: "#6364ff",
  65. 600: "#563acc", // "main"
  66. 900: "#2f0c7a",
  67. },
  68. lime: "#baff3b",
  69. goldenrod: "#ffbe2e",
  70. },
  71. extend: {
  72. fontFamily: {
  73. sans: ["Manrope", "-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\""],
  74. },
  75. fontWeight: {
  76. extranormal: 450,
  77. },
  78. letterSpacing: {
  79. semiwide: ".01em",
  80. },
  81. backgroundImage: {
  82. "blurple-gradient": `linear-gradient(0deg, #563acc 12.87%, #6364ff 88.62%)`,
  83. },
  84. gap: {
  85. gutter: "var(--gutter-width)",
  86. },
  87. maxWidth: {
  88. site: "90rem",
  89. },
  90. spacing: {
  91. 26: "6.5rem",
  92. "footer-offset": "var(--footer-offset)",
  93. },
  94. dropShadow: {
  95. /** Used for text on hero images that may shift around */
  96. "safe-text": "0 0 30px #1d0023",
  97. },
  98. },
  99. },
  100. plugins: [
  101. /** CSS Logical Properties https://github.com/stevecochrane/tailwindcss-logical */
  102. require("tailwindcss-logical"),
  103. plugin(function ({ addVariant }) {
  104. /** A good default for hover states */
  105. addVariant("hocus", ["&:hover", "&:focus-visible"])
  106. /** Focus-visible inside of presentational containers */
  107. addVariant("focus-visible-within", ["&:has(:focus-visible)"])
  108. }),
  109. ],
  110. }
  111. module.exports = {
  112. ...config,
  113. safelist: [
  114. // needed for /guide
  115. ...Object.keys(config.theme.fontSize),
  116. ...Object.keys(config.theme.colors).reduce((arr, k) => {
  117. if (typeof config.theme.colors[k] === "string") {
  118. arr.push(`bg-${k}`)
  119. return arr
  120. } else {
  121. return arr.concat(
  122. Object.keys(config.theme.colors[k]).map((s) => `bg-${k}-${s}`)
  123. )
  124. }
  125. }, []),
  126. ],
  127. }