ProvenPin Install

picocolors ANSI color helpers: working versions (tested 2026-10-16)

Apply picocolors red, green, bold, dim and bgYellow helpers, asserting ANSI escape codes and plain output when coloring is disabled offline.

passed6 passed · 0 failed2026-10-16 17:50 UTC
Status
passed
Last passed
2026-10-16 17:50 UTC
Tests
6 / 6
Language
TypeScript
Runtime
node v22.23.3
pinned versions3
picocolors@1.1.1@types/node@26.6.5tsx@4.23.15
run it
npm install --no-audit --no-fund --ignore-scripts=false
npm test
test environment
node v22.23.3
linux 6.17.0-1022-azure
x64
runner: github-actions 38942732901

The code

Exactly the files that passed. Your agent can pull them with get_recipe("picocolors-ansi") (install), or see them on GitHub.

package.json
{
  "name": "picocolors-ansi",
  "private": true,
  "type": "module",
  "scripts": {
    "test": "node --import tsx --test test/*.test.ts"
  },
  "dependencies": {
    "picocolors": "1.1.1"
  },
  "devDependencies": {
    "@types/node": "26.6.5",
    "tsx": "4.23.15"
  }
}
src/colors.ts
import { createColors } from "picocolors";

export const color = createColors(true);
export const plain = createColors(false);

export function status(ok: boolean, label: string): string {
  const paint = ok ? color.green : color.red;
  return `${paint(color.bold(label))} ${color.dim("done")}`;
}

export function badge(text: string): string {
  return color.bgYellow(color.black(text));
}
test/colors.test.ts
import { test } from "node:test";
import assert from "node:assert/strict";
import { createColors } from "picocolors";
import { color, plain, status, badge } from "../src/colors.ts";

const ANSI = /\u001b\[[0-9;]*m/;

test("red and green helpers emit expected ANSI codes", () => {
  assert.equal(color.red("x"), "\u001b[31mx\u001b[39m");
  assert.equal(color.green("x"), "\u001b[32mx\u001b[39m");
  assert.match(color.red("fail"), ANSI);
  assert.match(color.green("ok"), ANSI);
});

test("bold and dim helpers emit expected ANSI codes", () => {
  assert.equal(color.bold("x"), "\u001b[1mx\u001b[22m");
  assert.equal(color.dim("x"), "\u001b[2mx\u001b[22m");
  assert.match(color.bold("x"), ANSI);
  assert.match(color.dim("x"), ANSI);
});

test("bgYellow helper emits expected background ANSI code", () => {
  const out = badge("note");
  assert.equal(out, "\u001b[43m\u001b[30mnote\u001b[39m\u001b[49m");
  assert.match(out, /\u001b\[43m/);
  assert.match(out, /\u001b\[30m/);
});

test("composed status line carries nested codes", () => {
  const ok = status(true, "build");
  assert.match(ok, /\u001b\[32m/);
  assert.match(ok, /\u001b\[1m/);
  assert.match(ok, /\u001b\[2m/);
  const bad = status(false, "build");
  assert.match(bad, /\u001b\[31m/);
});

test("coloring disabled yields plain output", () => {
  assert.equal(plain.isColorSupported, false);
  const off = createColors(false);
  assert.equal(off.isColorSupported, false);
  assert.equal(off.red("plain"), "plain");
  assert.equal(plain.bold(plain.green("plain")), "plain");
  assert.doesNotMatch(plain.red("plain"), ANSI);
});

test("coloring enabled reports support", () => {
  assert.equal(color.isColorSupported, true);
  assert.equal(createColors(true).isColorSupported, true);
});

Connect to ProvenPin

Add the free MCP server so your agent can pull this recipe and others like it. Same setup as the docs.

terminal
claude mcp add --transport http provenpin https://mcp.provenpin.com/mcp

Any other MCP client: Streamable HTTP at https://mcp.provenpin.com/mcp. No API key, no signup.