d6-profile-vue.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env node
  2. const fs = require('fs');
  3. const F = 'pages/profile-main/profile.vue';
  4. let src = fs.readFileSync(F, 'utf8');
  5. // defs 数组五维色 -> BrandColors 引用(brand-colors.js 已有 body/mind/wisdom/action/wealth)
  6. src = src.replace(
  7. "{ key: 'body', label: '身', color: '#FF8C42' }",
  8. "{ key: 'body', label: '身', color: BrandColors.body }"
  9. );
  10. src = src.replace(
  11. "{ key: 'mind', label: '心', color: '#FF6B9D' }",
  12. "{ key: 'mind', label: '心', color: BrandColors.mind }"
  13. );
  14. src = src.replace(
  15. "{ key: 'wisdom', label: '智', color: '#6366F1' }",
  16. "{ key: 'wisdom', label: '智', color: BrandColors.wisdom }"
  17. );
  18. src = src.replace(
  19. "{ key: 'action', label: '行', color: '#10B981' }",
  20. "{ key: 'action', label: '行', color: BrandColors.action }"
  21. );
  22. src = src.replace(
  23. "{ key: 'wealth', label: '富', color: '#F59E0B' }",
  24. "{ key: 'wealth', label: '富', color: BrandColors.wealth }"
  25. );
  26. fs.writeFileSync(F, src);
  27. console.log('defs mapped to BrandColors');
  28. // 统计剩余 hex
  29. const lines = src.split('\n');
  30. let n = 0;
  31. for (let i = 0; i < lines.length; i++) {
  32. if (/#[0-9a-fA-F]{3,8}\b/.test(lines[i])) {
  33. if (!/^\\s*\\$c-/.test(lines[i]) && !/BrandColors\./.test(lines[i])) {
  34. console.log('REMAIN ' + (i + 1) + ': ' + lines[i].trim());
  35. n++;
  36. }
  37. }
  38. }
  39. console.log('remaining non-palette, non-BrandColors:', n);