tailwind.config.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /** @type {import('tailwindcss').Config} */
  2. let configFontSize = {}
  3. let configLineHeight = {}
  4. for(let i=10;i<=64; i+=2){
  5. configFontSize[i] = [`${i}px`, `${i}px`]
  6. configLineHeight[i] = `${i}px`
  7. }
  8. let configSpace = {}
  9. for(let i=2;i<=200; i+=2){
  10. configSpace[i] = `${i}px`
  11. }
  12. let configBorderRadius = {}
  13. for(let i=2;i<=50; i+=2){
  14. configBorderRadius[i] = `${i}px`
  15. }
  16. module.exports = {
  17. // 这里给出了一份 taro 通用示例,具体要根据你自己项目的目录结构进行配置
  18. // 比如你使用 vue3 项目,你就需要把 vue 这个格式也包括进来
  19. // 不在 content glob表达式中包括的文件,在里面编写tailwindcss class,是不会生成对应的css工具类的
  20. content: ['./public/index.html', './src/**/*.{html,js,ts,jsx,tsx}'],
  21. // 其他配置项 ...
  22. corePlugins: {
  23. // 小程序不需要 preflight,因为这主要是给 h5 的,如果你要同时开发多端,你应该使用 process.env.TARO_ENV 环境变量来控制它
  24. preflight: false,
  25. },
  26. theme: {
  27. colors: {
  28. 'white': '#FFFFFF',
  29. 'white-70': 'rgba(255, 255, 255, 0.7)',
  30. 'primary': '#317CFA',
  31. 'primary-10': 'rgba(49, 124, 250, 0.1)',
  32. 'black': '#000000',
  33. 'dark': '#111A34;',
  34. 'black-3': '#333333',
  35. 'black-6': '#666666',
  36. 'black-9': '#999999',
  37. 'black-25': 'rgba(0, 0, 0, 0.25)',
  38. 'black-45': 'rgba(0, 0, 0, 0.45)',
  39. 'black-50': 'rgba(0, 0, 0, 0.5)',
  40. 'black-60': 'rgba(0, 0, 0, 0.6)',
  41. 'black-65': 'rgba(0, 0, 0, 0.65)',
  42. 'title': '#111A34',
  43. 'harsh': '#F94F17',
  44. 'purple': '#7e5bef',
  45. 'pink': '#ff49db',
  46. 'orange': '#FD561F',
  47. 'red': '#EE4949',
  48. 'green': '#31BE59',
  49. 'yellow': '#EE9E49',
  50. 'gray': '#f6f6f6',
  51. 'gray-page': '#f6f6f6',
  52. 'gray-dark': '#273444',
  53. 'gray-f8': '#F8F8F8',
  54. 'gray-25': 'rgba(0, 0, 0, 0.25)',
  55. 'gray-45': 'rgba(0, 0, 0, 0.45)',
  56. 'gray-65': 'rgba(0, 0, 0, 0.65)',
  57. 'gray-85': 'rgba(0, 0, 0, 0.85)',
  58. 'gray-sub': 'rgba(0, 0, 0, 0.75)',
  59. 'gray-light': 'rgba(0, 0, 0, 0.08)',
  60. 'gray-2': 'rgba(0, 0, 0, 0.02)',
  61. 'gray-3': 'rgba(0, 0, 0, 0.03)',
  62. 'gray-4': 'rgba(0, 0, 0, 0.04)',
  63. 'gray-fafafa': '#fafafa',
  64. },
  65. fontSize: {
  66. '11': '11px',
  67. ...configFontSize,
  68. },
  69. extend: {
  70. fontFamily: {
  71. pingfangSCMedium: ['PingFangSC-Medium'],
  72. pingfangSCSemibold: ['PingFangSC-Semibold'],
  73. },
  74. lineHeight: {
  75. '0': '0px',
  76. '1': '1px',
  77. ...configLineHeight,
  78. },
  79. spacing: configSpace,
  80. borderRadius: {
  81. DEFAULT: '8px',
  82. ...configBorderRadius,
  83. 'full': '9999px',
  84. }
  85. }
  86. }
  87. }