const fs = require('fs'); // Generate a compact, strictly-typed TypeScript module from the extracted palette JSON. const palette = JSON.parse( fs.readFileSync('D:/拼豆/competitor-analysis/mard-palette.json', 'utf8'), ); const lines = []; lines.push('/**'); lines.push(' * MARD 拼豆色板 — all colors, extracted from the competitor bundle.'); lines.push(' *'); lines.push(' * Each entry carries the MARD code, hex, sRGB and precomputed CIE LAB (D65) values.'); lines.push(' */'); lines.push(''); lines.push('export interface MardColor {'); lines.push(' code: string;'); lines.push(' hex: string;'); lines.push(' rgb: [number, number, number];'); lines.push(' lab: [number, number, number];'); lines.push('}'); lines.push(''); lines.push('export const MARD_PALETTE: readonly MardColor[] = ['); for (const c of palette) { lines.push( ` { code: '${c.code}', hex: '${c.hex}', rgb: [${c.rgb.join(', ')}], lab: [${c.lab.join(', ')}] },`, ); } lines.push('];'); lines.push(''); fs.writeFileSync( 'D:/拼豆/perler-lab/src/lib/mard-palette-data.ts', lines.join('\n'), 'utf8', ); console.log('generated entries:', palette.length);