Skip to content

Color

Color utilities with Protection Levels.

Pages

Quick Start

ts
import { Color } from "@briklab/lib/color";

const color = new Color({ r: 255, g: 0, b: 0 }, "boundary");
console.log(color.hex()); // "#ff0000"
console.log(color.rgb()); // "rgb(255, 0, 0)"
console.log(color.ansiTruecolor()); // ANSI sequence for red foreground
console.log(color.wrapAnsi("Hello", { bold: true })); // "Hello" wrapped in red and bold ANSI sequences