/* Welche Farbe traegt jede Kachel des Community-Bereichs? * * Gelesen wird aus den zwei Stellen, die es wirklich entscheiden: * workspace.js sagt, welche TON-NUMMER eine Kachel hat, start.css * sagt, welcher Farbwert hinter der Nummer steht. Abgeschrieben wird * nichts -- eine Liste, die niemand pflegt, kann nicht veralten. * * node tools/treff-farben.mjs */ import { readFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; import { dirname, join } from "node:path"; const HIER = dirname(fileURLToPath(import.meta.url)); const js = readFileSync(join(HIER, "..", "server", "workspace.js"), "utf8"); const css = readFileSync(join(HIER, "..", "workspace", "assets", "css", "start.css"), "utf8"); const hex = new Map(); for (const m of css.matchAll(/\[data-ton="(\d+)"\]\s*\{\s*--ton:\s*(#[0-9a-fA-F]{6})/g)) { hex.set(m[1], m[2]); } /* Die Kacheln des Treffs stehen alle mit `...TREFF_GRUPPE` davor -- daran sind sie erkennbar, ohne sie einzeln aufzuzaehlen. */ const treffer = [...js.matchAll( /\.\.\.TREFF_GRUPPE,\s*name:\s*"([^"]+)"[\s\S]{0,400}?ton:\s*(\d+)/g)]; console.log("KACHEL TON FARBE"); for (const [, name, ton] of treffer) { console.log(name.padEnd(20) + String(ton).padEnd(6) + (hex.get(ton) || "?")); } console.log("\n" + treffer.length + " Kacheln im Community-Bereich gefunden."); if (!treffer.length) { console.error("KEINE gefunden -- die Erkennung passt nicht mehr zum Quelltext."); process.exit(1); }