tmp_c2a4a_genrules.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """C-2a-4a:生成 16 个 style 变更文件的验证规则 JSON(.tmp_equiv/sub_c2a4a_*.json)"""
  4. import io
  5. import json
  6. import os
  7. import sys
  8. TMP = '.tmp_equiv'
  9. ORANGE = '#F97316'
  10. ORANGE_DARK = '#EA580C'
  11. ORANGE_LIGHT = '#FB923C'
  12. INFO = '#0EA5E9'
  13. PALE = '#FFF7ED'
  14. GRAD_3A7CC4 = 'linear-gradient(135deg, #5B9BD5, #3A7CC4)'
  15. GRAD_3A7CC2 = 'linear-gradient(135deg, #5B9BD5, #3A7CC2)'
  16. GRAD_ORANGE_DARK = 'linear-gradient(135deg, #F97316, #EA580C)'
  17. RULES = {
  18. 'gates': [
  19. ['border: 2rpx solid #5B9BD5', 'border: 2rpx solid ' + ORANGE],
  20. ['background: #5B9BD5', 'background: ' + ORANGE],
  21. ['color: #5B9BD5', 'color: ' + ORANGE],
  22. ['color: #3A7CC2', 'color: ' + INFO],
  23. ['rgba(66,165,245,0.15)', 'rgba(14,165,233,0.15)'],
  24. ],
  25. 't_families': [
  26. ['border-left: 8rpx solid #4A9BD7', 'border-left: 8rpx solid ' + ORANGE],
  27. ['background: #5B9BD5', 'background: ' + ORANGE],
  28. ],
  29. 't_index': [
  30. ['background: #4A9BD7', 'background: ' + ORANGE],
  31. ],
  32. 't_plancreate': [
  33. ['color: #4A9BD7', 'color: ' + ORANGE],
  34. ['border: 1rpx solid #4A9BD7', 'border: 1rpx solid ' + ORANGE],
  35. ['background: #4A9BD7', 'background: ' + ORANGE],
  36. ],
  37. 't_plandetail': [
  38. ['background: #4A9BD7', 'background: ' + ORANGE],
  39. ['color: #4A9BD7', 'color: ' + ORANGE],
  40. ],
  41. 't_planlist': [
  42. ['background: #4A9BD7', 'background: ' + ORANGE],
  43. ],
  44. 't_reviewfamily': [
  45. ['background: #4A9BD7', 'background: ' + ORANGE],
  46. ['color: #4A9BD7', 'color: ' + INFO],
  47. ],
  48. 't_reviewworkbench': [
  49. ['background: #4A9BD7', 'background: ' + ORANGE],
  50. ['color: #4A9BD7', 'color: ' + INFO],
  51. ],
  52. 'reportdetail': [
  53. ['#5B9BD5', ORANGE],
  54. ],
  55. 'profilemenu': [
  56. ['#5B9BD5', INFO],
  57. ],
  58. 'coupons': [
  59. ['color: #5B9BD5', 'color: ' + INFO],
  60. ['background: #5B9BD5', 'background: ' + ORANGE],
  61. ],
  62. 'reportmgmt': [
  63. ['#5B9BD5', ORANGE],
  64. ],
  65. 'profileindex': [
  66. [GRAD_3A7CC4, GRAD_ORANGE_DARK],
  67. ],
  68. 'memberhomedetail': [
  69. [GRAD_3A7CC4, GRAD_ORANGE_DARK],
  70. ['#5B9BD5', ORANGE],
  71. ],
  72. 'articleedit': [
  73. ['#E8F4FD', PALE],
  74. ['#5B9BD5', ORANGE],
  75. ],
  76. 'gatelock': [
  77. [GRAD_3A7CC2, GRAD_ORANGE_DARK],
  78. ['color: #8FC5E8', 'color: ' + ORANGE_LIGHT],
  79. ['rgba(143,197,232,0.7)', 'rgba(251,146,60,0.7)'],
  80. ['rgba(143,197,232,0.5)', 'rgba(251,146,60,0.5)'],
  81. ],
  82. }
  83. def main():
  84. if not os.path.isdir(TMP):
  85. os.makedirs(TMP)
  86. for name, rules in RULES.items():
  87. p = os.path.join(TMP, 'sub_c2a4a_%s.json' % name)
  88. io.open(p, 'w', encoding='utf-8').write(json.dumps(rules, ensure_ascii=False, indent=2))
  89. print('written %s (%d rules)' % (p, len(rules)))
  90. if __name__ == '__main__':
  91. sys.exit(main())