#!/usr/bin/env node const fs = require('fs'); const F = 'pages/profile-main/profile.vue'; let src = fs.readFileSync(F, 'utf8'); // defs 数组五维色 -> BrandColors 引用(brand-colors.js 已有 body/mind/wisdom/action/wealth) src = src.replace( "{ key: 'body', label: '身', color: '#FF8C42' }", "{ key: 'body', label: '身', color: BrandColors.body }" ); src = src.replace( "{ key: 'mind', label: '心', color: '#FF6B9D' }", "{ key: 'mind', label: '心', color: BrandColors.mind }" ); src = src.replace( "{ key: 'wisdom', label: '智', color: '#6366F1' }", "{ key: 'wisdom', label: '智', color: BrandColors.wisdom }" ); src = src.replace( "{ key: 'action', label: '行', color: '#10B981' }", "{ key: 'action', label: '行', color: BrandColors.action }" ); src = src.replace( "{ key: 'wealth', label: '富', color: '#F59E0B' }", "{ key: 'wealth', label: '富', color: BrandColors.wealth }" ); fs.writeFileSync(F, src); console.log('defs mapped to BrandColors'); // 统计剩余 hex const lines = src.split('\n'); let n = 0; for (let i = 0; i < lines.length; i++) { if (/#[0-9a-fA-F]{3,8}\b/.test(lines[i])) { if (!/^\\s*\\$c-/.test(lines[i]) && !/BrandColors\./.test(lines[i])) { console.log('REMAIN ' + (i + 1) + ': ' + lines[i].trim()); n++; } } } console.log('remaining non-palette, non-BrandColors:', n);