tailwind.config.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. // 基础色板
  29. 'primary': '#327BF9', // 品牌色
  30. 'primary-light': '#EBF4FF',
  31. 'warn': '#FD7F2C',
  32. 'warn-light': '#FFF2E9',
  33. 'success': '#31BE59',
  34. 'success-light': '#EAF8EE',
  35. 'error': '#EE4949',
  36. 'error-light': '#FDEDED',
  37. 'red': '#FF4747',
  38. // 中性色板
  39. 'gray-1': 'rgba(17, 17, 17, 0.03)', // 未选中按钮背景
  40. 'gray-2': 'rgba(17, 17, 17, 0.05)', // 骨架图卡片模块
  41. 'gray-3': 'rgba(17, 17, 17, 0.25)', // 分割线,未编辑边框,禁用文本
  42. 'gray-4': 'rgba(17, 17, 17, 0.45)', // 辅助文本,输入文本,仅展示,暗文本
  43. 'gray-5': 'rgba(17, 17, 17, 0.65)', // 副标题,描述文本
  44. 'gray-6': 'rgba(17, 17, 17, 0.85)', // 正文
  45. 'gray-7': 'rgba(17, 17, 17, 1)', // 特殊标题,主标题,正文
  46. // deprecated
  47. 'white': '#FFFFFF',
  48. 'white-70': 'rgba(255, 255, 255, 0.7)',
  49. 'primary-10': 'rgba(49, 124, 250, 0.1)',
  50. 'black': '#000000',
  51. 'dark': '#111A34;',
  52. 'black-3': '#333333',
  53. 'black-6': '#666666',
  54. 'black-9': '#999999',
  55. 'black-25': 'rgba(0, 0, 0, 0.25)',
  56. 'black-45': 'rgba(0, 0, 0, 0.45)',
  57. 'black-50': 'rgba(0, 0, 0, 0.5)',
  58. 'black-60': 'rgba(0, 0, 0, 0.6)',
  59. 'black-65': 'rgba(0, 0, 0, 0.65)',
  60. 'title': '#111111',
  61. 'text': 'rgba(17, 17, 17, 0.85)',
  62. 'harsh': '#F94F17',
  63. 'purple': '#7e5bef',
  64. 'pink': '#ff49db',
  65. 'orange': '#FD561F',
  66. 'green': '#31BE59',
  67. 'yellow': '#EE9E49',
  68. 'gray': '#f6f6f6',
  69. 'gray-page': '#f6f6f6',
  70. 'gray-dark': '#273444',
  71. 'gray-f8': '#F8F8F8',
  72. 'gray-sub': 'rgba(17, 17, 17, 0.75)',
  73. 'gray-light': 'rgba(17, 17, 17, 0.08)',
  74. 'gray-fafafa': '#fafafa',
  75. },
  76. fontSize: {
  77. '11': '11px',
  78. ...configFontSize,
  79. },
  80. extend: {
  81. fontFamily: {
  82. pingfangSCMedium: ['PingFangSC-Medium'],
  83. pingfangSCSemibold: ['PingFangSC-Semibold'],
  84. },
  85. lineHeight: {
  86. '0': '0px',
  87. '1': '1px',
  88. ...configLineHeight,
  89. },
  90. spacing: configSpace,
  91. borderRadius: {
  92. DEFAULT: '8px',
  93. ...configBorderRadius,
  94. 'full': '9999px',
  95. }
  96. }
  97. }
  98. }