Skip to content

Basinfy/Basinfy-SaaS-Studio / .claude/skills/saas-frontend-taste

saas-frontend-taste

Verified

Design, refine, and verify SaaS screens with anti-slop copy and responsive layout checks.

FileKindSize
SKILL.mdskill md11.1 KB
assets/backgrounds/backgrounds.cssother41.5 KB
assets/backgrounds/backgrounds.jsscript8.9 KB
assets/backgrounds/check.htmlother4.8 KB
assets/backgrounds/check.mjsscript14.2 KB
assets/backgrounds/demo.htmlother43.3 KB
assets/backgrounds/index.jsonconfig19.6 KB
assets/backgrounds/pick.mjsscript14.0 KB
assets/diagrams/demo.htmlother11.4 KB
assets/diagrams/diagram.cssother25.5 KB
assets/diagrams/diagram.jsscript89.2 KB
assets/diagrams/lab.htmlother11.2 KB
assets/diagrams/mount.jsscript609 B
assets/diagrams/presets.jsonconfig27.9 KB
assets/layout/check.mjsscript15.8 KB
assets/layout/deal.mjsscript9.5 KB
assets/layout/demo.cssother5.7 KB
assets/layout/fonts.htmlother9.5 KB
assets/layout/hero-centred.htmlother16.4 KB
assets/layout/hero-collage.htmlother15.7 KB
assets/layout/hero-editorial.htmlother8.1 KB
assets/layout/hero-film.htmlother7.8 KB
assets/layout/hero-photo.htmlother7.8 KB
assets/layout/hero-place.htmlother6.7 KB
assets/layout/hero-product.htmlother7.7 KB
assets/layout/hero-split.htmlother7.8 KB
assets/layout/hero-statement.htmlother8.4 KB
assets/layout/hero-triptych.htmlother14.2 KB
assets/layout/hero-word.htmlother10.1 KB
assets/layout/heroes.jsonconfig36.7 KB
assets/layout/img/credits.jsonconfig8.2 KB
assets/layout/img/photo-1068.jpgbinary48.0 KB
assets/layout/img/photo-1081.jpgbinary40.5 KB
assets/layout/img/photo-465.jpgbinary19.6 KB
assets/layout/img/photo-559.jpgbinary86.2 KB
assets/layout/img/photo-855.jpgbinary25.8 KB
assets/layout/img/photo-887.jpgbinary66.8 KB
assets/layout/img/photo-949.jpgbinary37.1 KB
assets/layout/img/photo-954.jpgbinary17.4 KB
assets/layout/img/photo-beans-hand.jpgbinary17.1 KB
assets/layout/img/photo-c166.jpgbinary32.3 KB
assets/layout/img/photo-c400.jpgbinary98.8 KB
assets/layout/img/photo-c7.jpgbinary24.7 KB
assets/layout/img/photo-c70.jpgbinary32.4 KB
assets/layout/img/photo-c8.jpgbinary25.1 KB
assets/layout/img/photo-c823.jpgbinary34.7 KB
assets/layout/img/photo-c96.jpgbinary33.0 KB
assets/layout/img/photo-d534.jpgbinary121.7 KB
assets/layout/img/photo-d540.jpgbinary119.9 KB
assets/layout/img/photo-d88.jpgbinary38.8 KB
assets/layout/img/photo-m61660576.jpgbinary39.5 KB
assets/layout/img/photo-m61757972.jpgbinary43.6 KB
assets/layout/layout-check.jsscript21.1 KB
assets/layout/layout.cssother44.4 KB
assets/layout/layout.jsscript14.8 KB
assets/moments/_demo/credits.jsonconfig1.3 KB
assets/moments/_demo/demo.cssother6.8 KB
assets/moments/_demo/in-card.htmlother1.8 KB
assets/moments/_demo/in-page-service.htmlother10.3 KB
assets/moments/_demo/in-page.htmlother9.6 KB
assets/moments/_demo/photo-1049-tall.jpgbinary36.5 KB
assets/moments/_demo/photo-1049.jpgbinary27.9 KB
assets/moments/_demo/photo-1081.jpgbinary39.9 KB
assets/moments/_demo/photo-640.jpgbinary102.7 KB
assets/moments/_demo/photo-702-tall.jpgbinary100.0 KB
assets/moments/_demo/photo-702.jpgbinary80.0 KB
assets/moments/_demo/photo-855.jpgbinary25.4 KB
assets/moments/_demo/photo-887.jpgbinary62.7 KB
assets/moments/closing-lift/demo.htmlother4.3 KB
assets/moments/closing-lift/meta.jsonconfig1.3 KB
assets/moments/closing-lift/moment.cssother2.3 KB
assets/moments/closing-lift/moment.jsscript2.9 KB
assets/moments/counter-rolls/demo.htmlother5.3 KB
assets/moments/counter-rolls/meta.jsonconfig913 B
assets/moments/counter-rolls/moment.cssother718 B
assets/moments/counter-rolls/moment.jsscript3.3 KB
assets/moments/cursor-spotlight/demo.htmlother4.3 KB
assets/moments/cursor-spotlight/meta.jsonconfig1.2 KB
assets/moments/cursor-spotlight/moment.cssother1.2 KB
assets/moments/cursor-spotlight/moment.jsscript2.2 KB
assets/moments/gallery.htmlother8.2 KB
assets/moments/giant-type-pass/demo.htmlother3.6 KB
assets/moments/giant-type-pass/meta.jsonconfig1.0 KB
assets/moments/giant-type-pass/moment.cssother1.5 KB
assets/moments/giant-type-pass/moment.jsscript2.0 KB
assets/moments/headline-arrives/demo.htmlother3.9 KB
assets/moments/headline-arrives/meta.jsonconfig1.0 KB
assets/moments/headline-arrives/moment.cssother1.6 KB
assets/moments/headline-arrives/moment.jsscript2.6 KB
assets/moments/index.jsonconfig21.4 KB
assets/moments/iris-opens/demo.htmlother4.9 KB
assets/moments/iris-opens/meta.jsonconfig1.3 KB
assets/moments/iris-opens/moment.cssother2.0 KB
assets/moments/iris-opens/moment.jsscript4.6 KB
assets/moments/letters-assemble/demo.htmlother4.2 KB
assets/moments/letters-assemble/meta.jsonconfig1.0 KB
assets/moments/letters-assemble/moment.cssother1.1 KB
assets/moments/letters-assemble/moment.jsscript2.9 KB
assets/moments/lib.jsscript10.5 KB
assets/moments/line-carries-colour/demo.htmlother4.4 KB
assets/moments/line-carries-colour/meta.jsonconfig1.4 KB
assets/moments/line-carries-colour/moment.cssother1.6 KB
assets/moments/line-carries-colour/moment.jsscript4.0 KB
assets/moments/lines-rise/demo.htmlother5.1 KB
assets/moments/lines-rise/meta.jsonconfig984 B
assets/moments/lines-rise/moment.cssother1.3 KB
assets/moments/lines-rise/moment.jsscript3.0 KB
assets/moments/liquid-hover/demo.htmlother3.3 KB
assets/moments/liquid-hover/meta.jsonconfig1.4 KB
assets/moments/liquid-hover/moment.cssother457 B
assets/moments/liquid-hover/moment.jsscript13.1 KB
assets/moments/liquid-type/demo.htmlother3.0 KB
assets/moments/liquid-type/meta.jsonconfig1.0 KB
assets/moments/liquid-type/moment.cssother462 B
assets/moments/liquid-type/moment.jsscript4.1 KB
assets/moments/marquee-row/demo.htmlother4.3 KB
assets/moments/marquee-row/meta.jsonconfig867 B
assets/moments/marquee-row/moment.cssother2.0 KB
assets/moments/marquee-row/moment.jsscript2.4 KB
assets/moments/moments.jsscript6.0 KB
assets/moments/photo-chapters/demo.htmlother5.1 KB
assets/moments/photo-chapters/meta.jsonconfig1.8 KB
assets/moments/photo-chapters/moment.cssother6.2 KB
assets/moments/photo-chapters/moment.jsscript6.1 KB
assets/moments/picture-develops/demo-film.htmlother3.9 KB
assets/moments/picture-develops/demo.htmlother4.2 KB
assets/moments/picture-develops/meta.jsonconfig1.4 KB
assets/moments/picture-develops/moment.cssother1.9 KB
assets/moments/picture-develops/moment.jsscript9.2 KB
assets/moments/pinned-chapters/demo.htmlother5.4 KB
assets/moments/pinned-chapters/meta.jsonconfig1.3 KB
assets/moments/pinned-chapters/moment.cssother6.9 KB
assets/moments/pinned-chapters/moment.jsscript4.2 KB
assets/moments/window-parallax/demo.htmlother3.8 KB
assets/moments/window-parallax/meta.jsonconfig913 B
assets/moments/window-parallax/moment.cssother591 B
assets/moments/window-parallax/moment.jsscript1.2 KB
assets/moments/word-highlight/demo.htmlother4.5 KB
assets/moments/word-highlight/meta.jsonconfig1.0 KB
assets/moments/word-highlight/moment.cssother849 B
assets/moments/word-highlight/moment.jsscript2.0 KB
assets/moments/word-rotate/demo.htmlother4.5 KB
assets/moments/word-rotate/meta.jsonconfig948 B
assets/moments/word-rotate/moment.cssother906 B
assets/moments/word-rotate/moment.jsscript2.2 KB
assets/motion/_hover-test.htmlother1.4 KB
assets/motion/demo.htmlother34.1 KB
assets/motion/meta.jsonconfig2.7 KB
assets/motion/motion.cssother25.1 KB
assets/motion/motion.jsscript22.8 KB
assets/starter.htmlother34.2 KB
assets/system.cssother100.5 KB
assets/system.jsscript34.9 KB
assets/ui/_lab/build-index.mjsscript4.0 KB
assets/ui/_lab/loops.htmlother8.7 KB
assets/ui/_lab/object-card.htmlother4.7 KB
assets/ui/_lab/selftest.htmlother3.1 KB
assets/ui/apps/fragment.cssother3.0 KB
assets/ui/apps/fragment.htmlother2.3 KB
assets/ui/apps/fragment.jsscript2.0 KB
assets/ui/apps/meta.jsonconfig1.6 KB
assets/ui/base.cssother15.7 KB
assets/ui/calendar/fragment.cssother4.4 KB
assets/ui/calendar/fragment.htmlother3.4 KB
assets/ui/calendar/fragment.jsscript3.4 KB
assets/ui/calendar/meta.jsonconfig957 B
assets/ui/cards.cssother21.6 KB
assets/ui/cards.htmlother52.3 KB
assets/ui/chat/fragment.cssother3.9 KB
assets/ui/chat/fragment.htmlother5.0 KB
assets/ui/chat/fragment.jsscript2.9 KB
assets/ui/chat/meta.jsonconfig1.1 KB
assets/ui/checklist/fragment.cssother2.2 KB
assets/ui/checklist/fragment.htmlother1.3 KB
assets/ui/checklist/fragment.jsscript1.5 KB
assets/ui/checklist/meta.jsonconfig901 B
assets/ui/code/fragment.cssother2.6 KB
assets/ui/code/fragment.htmlother1.6 KB
assets/ui/code/fragment.jsscript1.7 KB
assets/ui/code/meta.jsonconfig857 B
assets/ui/cursor/fragment.cssother2.4 KB
assets/ui/cursor/fragment.htmlother1.7 KB
assets/ui/cursor/fragment.jsscript3.2 KB
assets/ui/cursor/meta.jsonconfig1.2 KB
assets/ui/diff-review/fragment.cssother13.9 KB
assets/ui/diff-review/fragment.htmlother4.9 KB
assets/ui/diff-review/fragment.jsscript2.4 KB
assets/ui/diff-review/meta.jsonconfig3.9 KB
assets/ui/doc/fragment.cssother2.4 KB
assets/ui/doc/fragment.htmlother1.2 KB
assets/ui/doc/fragment.jsscript3.2 KB
assets/ui/doc/meta.jsonconfig1.2 KB
assets/ui/files/fragment.cssother3.9 KB
assets/ui/files/fragment.htmlother3.3 KB
assets/ui/files/fragment.jsscript3.4 KB
assets/ui/files/meta.jsonconfig1.7 KB
assets/ui/icons/asana.svgother1004 B
assets/ui/icons/calendly.svgother1.8 KB
assets/ui/icons/confluence.svgother2.4 KB
assets/ui/icons/docker.svgother2.2 KB

assets/backgrounds/check.mjs

View on GitHub
#!/usr/bin/env node
/*
  taste-skill backgrounds check.mjs - measures the contrast of the page ink (7:1) and the muted ink (4.5:1)
  on every ground, on every palette, from real pixels.

    node assets/backgrounds/check.mjs --profile <profile-dir> [--palettes id,id] [--grounds mist,halo]
                                      [--lit sand,painting] [--json out.json] [--save dir] [--min-ink 7] [--min-muted 4.5] [--port 5967]

  It serves the skill folder over http on 127.0.0.1 (5965-5969) and opens check.html in ONE headless Chrome (WebGL on the CPU flags, no window; closed by its own PID),
  sets each palette's --p-* tokens and the lit ground, screenshots the grounds' boxes, and reads the ink and
  muted colours the ground really resolves to. Each ground's text zone (index.json, fractions of its box)
  is cut into 8px blocks; the worst block's ratio is the result. Exit code 1 when a ground fails.
*/
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import zlib from 'node:zlib';
import http from 'node:http';
import { fileURLToPath } from 'node:url';
import { spawn, execFileSync } from 'node:child_process';

const HERE = path.dirname(fileURLToPath(import.meta.url));
const SKILL = path.resolve(HERE, '..', '..');
const args = process.argv.slice(2);
const opt = (k, d) => { const i = args.indexOf('--' + k); return i < 0 ? d : (args[i + 1] && !args[i + 1].startsWith('--') ? args[i + 1] : true); };
// default Chrome profile folder: --profile, else $TASTE_SKILL_TMP/chrome/<tool>-<pid>, else a fresh folder under the system temp dir
const defaultProfile = () => process.env.TASTE_SKILL_TMP ? path.join(process.env.TASTE_SKILL_TMP, 'chrome', 'bg-check-' + process.pid) : path.join(os.tmpdir(), 'taste-skill-bg-check-' + process.pid);
const profile = (p => (p && p !== true ? p : defaultProfile()))(opt('profile'));
const MIN_INK = +opt('min-ink', 7), MIN_MUTED = +opt('min-muted', 4.5), SCALE = 0.5, BLOCK = 4;
const sleep = ms => new Promise(r => setTimeout(r, ms));

/* ---------------------------------------------------------------- data */
const meta = JSON.parse(fs.readFileSync(path.join(HERE, 'index.json'), 'utf8')).grounds;
const zones = {};                                    // box id -> text zone
for (const g of meta) { zones[g.id] = g.textZone; if (g.variants) for (const v of g.variants) zones[v.id] = v.textZone || g.textZone; if (g.checkFrames) for (const f of g.checkFrames) zones[f] = g.textZone; }
const boxIds = Object.keys(zones);
const wantGrounds = opt('grounds') ? String(opt('grounds')).split(',') : null;
const lits = opt('lit') ? String(opt('lit')).split(',') : ['sand', 'painting'];
const tokensOf = id => {
  const css = execFileSync('node', [path.join(SKILL, 'scripts', 'start.mjs'), 'css', '--page', 'software', '--palette', id, '--type', 'hanken', '--radius', 'soft', '--history', path.join(path.resolve(profile), 'start-history.json')], { encoding: 'utf8' });   // the face does not matter here, only the --p-* colours; the history goes into the profile folder, not the page's .taste-skill
  const t = {};
  for (const m of css.matchAll(/--p-([a-z-]+):\s*(#[0-9a-fA-F]{3,8})/g)) t[m[1]] = m[2];
  return t;
};
const allIds = JSON.parse(fs.readFileSync(path.join(SKILL, 'library', 'palettes.json'), 'utf8')).map(p => p.id);
const palIds = opt('palettes') ? String(opt('palettes')).split(',') : allIds;

/* ---------------------------------------------------------------- PNG (8-bit RGB/RGBA) */
function decodePNG(buf) {
  let pos = 8, w = 0, h = 0, type = 0; const idat = [];
  while (pos < buf.length) {
    const len = buf.readUInt32BE(pos), name = buf.toString('ascii', pos + 4, pos + 8), data = buf.subarray(pos + 8, pos + 8 + len);
    if (name === 'IHDR') { w = data.readUInt32BE(0); h = data.readUInt32BE(4); type = data[9]; } else if (name === 'IDAT') idat.push(data);
    pos += 12 + len;
  }
  const bpp = type === 6 ? 4 : 3, raw = zlib.inflateSync(Buffer.concat(idat)), stride = w * bpp, px = Buffer.alloc(w * h * 3);
  let prev = Buffer.alloc(stride);
  for (let y = 0; y < h; y++) {
    const f = raw[y * (stride + 1)], line = Buffer.from(raw.subarray(y * (stride + 1) + 1, (y + 1) * (stride + 1)));
    for (let i = 0; i < stride; i++) {
      const a = i >= bpp ? line[i - bpp] : 0, b = prev[i], c = i >= bpp ? prev[i - bpp] : 0; let v = line[i];
      if (f === 1) v += a; else if (f === 2) v += b; else if (f === 3) v += (a + b) >> 1;
      else if (f === 4) { const p = a + b - c, pa = Math.abs(p - a), pb = Math.abs(p - b), pc = Math.abs(p - c); v += pa <= pb && pa <= pc ? a : pb <= pc ? b : c; }
      line[i] = v & 255;
    }
    for (let x = 0; x < w; x++) { const o = (y * w + x) * 3; px[o] = line[x * bpp]; px[o + 1] = line[x * bpp + 1]; px[o + 2] = line[x * bpp + 2]; }
    prev = line;
  }
  return { w, h, px };
}
const lin = c => { c /= 255; return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4; };
const lum = (r, g, b) => 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
const ratio = (a, b) => (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);

/* ---------------------------------------------------------------- Chrome */
const findChrome = () => ['C:/Program Files/Google/Chrome/Application/chrome.exe', 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe', process.env.CHROME_PATH, '/usr/bin/google-chrome', '/usr/bin/chromium', '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'].find(p => p && fs.existsSync(p));
const prof = path.resolve(profile); fs.mkdirSync(prof, { recursive: true });
const portFile = path.join(prof, 'DevToolsActivePort'); try { fs.rmSync(portFile); } catch { /* none */ }
const child = spawn(findChrome(), ['--headless=new', `--user-data-dir=${prof}`, '--remote-debugging-port=0', '--no-first-run', '--no-default-browser-check',
  '--disable-extensions', '--hide-scrollbars', '--mute-audio', '--disable-gpu', '--use-angle=swiftshader', '--enable-unsafe-swiftshader', '--window-size=800,900', 'about:blank'], { stdio: 'ignore', windowsHide: true });
const kill = () => { if (child.exitCode != null) return; try { execFileSync('taskkill', ['/PID', String(child.pid), '/T', '/F'], { stdio: 'ignore' }); } catch { try { child.kill(); } catch { /* gone */ } } };
// the page is served over http on 127.0.0.1 (5965-5969, --port), never opened from file://
const PORT = +opt('port', 5967);
if (PORT < 5965 || PORT > 5969) { console.error('check: --port must be 5965-5969'); process.exit(1); }
const MIME = { '.html': 'text/html; charset=utf-8', '.css': 'text/css; charset=utf-8', '.js': 'text/javascript; charset=utf-8', '.json': 'application/json', '.jpg': 'image/jpeg', '.png': 'image/png', '.svg': 'image/svg+xml', '.webp': 'image/webp' };
const srv = http.createServer((req, res) => {
  const file = path.join(SKILL, decodeURIComponent(new URL(req.url, 'http://x').pathname));
  if (!file.startsWith(SKILL) || !fs.existsSync(file) || fs.statSync(file).isDirectory()) { res.writeHead(404); return res.end(); }
  res.writeHead(200, { 'content-type': MIME[path.extname(file).toLowerCase()] || 'application/octet-stream', 'cache-control': 'no-store' });
  fs.createReadStream(file).pipe(res);
});
await new Promise((resolve, reject) => { srv.on('error', reject); srv.listen(PORT, '127.0.0.1', resolve); });
const guard = setTimeout(() => { console.error('check: timed out'); kill(); process.exit(2); }, 25 * 60 * 1000);

const results = [];
try {
  let port = null;
  for (let i = 0; i < 150 && !port; i++) { await sleep(100); try { port = parseInt(fs.readFileSync(portFile, 'utf8'), 10) || null; } catch { /* not yet */ } }
  if (!port) throw new Error('Chrome did not start');
  const ver = await (await fetch(`http://127.0.0.1:${port}/json/version`)).json();
  const ws = new WebSocket(ver.webSocketDebuggerUrl);
  await new Promise((r, j) => { ws.addEventListener('open', r, { once: true }); ws.addEventListener('error', j, { once: true }); });
  let id = 0; const pend = new Map(), subs = [];
  ws.addEventListener('message', e => { const m = JSON.parse(e.data); if (m.id && pend.has(m.id)) { pend.get(m.id)(m); pend.delete(m.id); } else subs.forEach(f => f(m)); });
  const send = (method, params = {}, sessionId) => new Promise(r => { const i = ++id; pend.set(i, r); ws.send(JSON.stringify({ id: i, method, params, sessionId })); });
  const { result: { targetId } } = await send('Target.createTarget', { url: 'about:blank' });
  const { result: { sessionId } } = await send('Target.attachToTarget', { targetId, flatten: true });
  const S = async (m, p) => { const r = await send(m, p, sessionId); if (r.error) throw new Error(`${m}: ${r.error.message}`); return r.result; };
  const ev = async x => { const r = await S('Runtime.evaluate', { expression: x, awaitPromise: true, returnByValue: true }); if (r.exceptionDetails) throw new Error(r.exceptionDetails.exception?.description || r.exceptionDetails.text); return r.result.value; };
  await S('Page.enable'); await S('Runtime.enable');
  await S('Emulation.setDeviceMetricsOverride', { width: 800, height: 900, deviceScaleFactor: 1, mobile: false });
  const loaded = new Promise(r => subs.push(m => { if (m.method === 'Page.loadEventFired') r(); }));
  await S('Page.navigate', { url: `http://127.0.0.1:${PORT}/assets/backgrounds/check.html` });
  await Promise.race([loaded, sleep(15000)]);
  await sleep(300);

  for (const pid of palIds) {
    const tk = tokensOf(pid);
    for (const lit of lits) {
      const info = await ev(`(async () => {
        const root = document.documentElement, tk = ${JSON.stringify(tk)};
        for (const [k, v] of Object.entries(tk)) root.style.setProperty('--p-' + k, v);
        root.dataset.ground = ${JSON.stringify(lit)};
        window.tasteBackgrounds.detect();
        const only = ${JSON.stringify(wantGrounds)};
        for (const el of document.querySelectorAll('.box')) el.style.display = !only || only.includes(el.dataset.g) || only.includes(el.dataset.g.split('-')[0]) ? '' : 'none';
        await new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)));
        const cv = document.createElement('canvas').getContext('2d', { willReadFrequently: true });
        const rgb = c => { cv.clearRect(0, 0, 1, 1); cv.fillStyle = '#000'; cv.fillStyle = c; cv.fillRect(0, 0, 1, 1); return [...cv.getImageData(0, 0, 1, 1).data.slice(0, 3)]; };
        const out = { mode: root.dataset.mode, tint: root.dataset.tint || '', boxes: {} };
        for (const el of document.querySelectorAll('.box')) {
          const r = el.getBoundingClientRect();
          out.boxes[el.dataset.g] = { top: r.top + scrollY, left: r.left + scrollX, h: r.height, w: r.width, rad: parseFloat(getComputedStyle(el).borderTopLeftRadius) || 0, ink: rgb(getComputedStyle(el.querySelector('.pi')).color), muted: rgb(getComputedStyle(el.querySelector('.pm')).color) };
        }
        out.k = getComputedStyle(root).getPropertyValue('--g-k').trim(); out.kd = getComputedStyle(root).getPropertyValue('--g-kd').trim();
        out.height = document.documentElement.scrollHeight;
        return out;
      })()`);
      await sleep(250);
      const { data } = await S('Page.captureScreenshot', { format: 'png', captureBeyondViewport: true, clip: { x: 0, y: 0, width: 800, height: info.height, scale: SCALE } });
      if (opt('save') && opt('save') !== true) { fs.mkdirSync(opt('save'), { recursive: true }); fs.writeFileSync(path.join(String(opt('save')), `${pid}-${lit}.png`), Buffer.from(data, 'base64')); }
      const img = decodePNG(Buffer.from(data, 'base64'));
      for (const bid of boxIds) {
        if (wantGrounds && !wantGrounds.includes(bid) && !wantGrounds.includes(bid.split('-')[0])) continue;
        const b = info.boxes[bid]; if (!b || !b.h) continue;
        const [zx0, zy0, zx1, zy1] = zones[bid];
        const ins = b.rad ? Math.ceil(b.rad * 0.3) + 2 : 0;   // a rounded box (bg-inset): the four corners outside the curve are the page, not the ground
        const x0 = Math.floor((b.left + b.w * zx0 + (zx0 === 0 ? ins : 0)) * SCALE), x1 = Math.floor((b.left + b.w * zx1 - (zx1 === 1 ? ins : 0)) * SCALE), y0 = Math.floor((b.top + b.h * zy0 + (zy0 === 0 ? ins : 0)) * SCALE), y1 = Math.floor((b.top + b.h * zy1 - (zy1 === 1 ? ins : 0)) * SCALE);
        const Li = lum(...b.ink), Lm = lum(...b.muted);
        let worstInk = 99, worstMuted = 99;
        for (let by = y0; by + BLOCK <= y1; by += BLOCK) for (let bx = x0; bx + BLOCK <= x1; bx += BLOCK) {
          let r = 0, g = 0, bl = 0;
          for (let y = by; y < by + BLOCK; y++) for (let x = bx; x < bx + BLOCK; x++) { const o = (y * img.w + x) * 3; r += img.px[o]; g += img.px[o + 1]; bl += img.px[o + 2]; }
          const n = BLOCK * BLOCK, Lb = lum(r / n, g / n, bl / n);
          worstInk = Math.min(worstInk, ratio(Li, Lb)); worstMuted = Math.min(worstMuted, ratio(Lm, Lb));
        }
        results.push({ inkRgb: b.ink.join(','), box: [b.left, b.top, b.w, b.h].map(Math.round).join(','), palette: pid, lit, ground: bid, mode: info.mode, tint: info.tint, k: info.k, kd: info.kd, ink: +worstInk.toFixed(2), muted: +worstMuted.toFixed(2), pass: worstInk >= MIN_INK && worstMuted >= MIN_MUTED });
      }
    }
    process.stderr.write(`${pid} `);
  }
  try { await Promise.race([send('Browser.close'), sleep(3000)]); } catch { /* closing */ }
} catch (e) {
  console.error('check:', e.message); process.exitCode = 1;
} finally {
  clearTimeout(guard); await sleep(300); kill(); srv.close();
}

/* ---------------------------------------------------------------- report */
const fails = results.filter(r => !r.pass);
const by = {};
for (const r of results) { const k = r.ground; (by[k] ||= { n: 0, fail: 0, minInk: 99, minMuted: 99, bad: new Set() }); by[k].n++; by[k].minInk = Math.min(by[k].minInk, r.ink); by[k].minMuted = Math.min(by[k].minMuted, r.muted); if (!r.pass) { by[k].fail++; by[k].bad.add(r.palette); } }
console.log('\n');
console.log('ground'.padEnd(12), 'runs'.padStart(5), 'fail'.padStart(5), 'min ink'.padStart(8), 'min muted'.padStart(10), ' failing palettes');
for (const [k, v] of Object.entries(by)) console.log(k.padEnd(12), String(v.n).padStart(5), String(v.fail).padStart(5), v.minInk.toFixed(2).padStart(8), v.minMuted.toFixed(2).padStart(10), ' ', [...v.bad].slice(0, 12).join(', ') + (v.bad.size > 12 ? ` +${v.bad.size - 12}` : ''));
const jf = opt('json'); if (jf && jf !== true) fs.writeFileSync(jf, JSON.stringify(results, null, 1));
console.log(`\n${results.length - fails.length}/${results.length} passed (ink >= ${MIN_INK}, muted >= ${MIN_MUTED})`);
if (fails.length) process.exitCode = 1;
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall