roundel
API reference

roundel/tokens

Every export of roundel/tokens, with its signature and doc comment: sgr, error, warn, ok, hint, muted and 4 more, plus 2 types.

import { sgr, error, warn, … } from 'roundel/tokens';

Functions

sgr

Wrap s in a chain of SGR pairs, outermost first, as chalk does: a close already inside s is followed by a re-open so a nested style survives it, and every line break closes before it and re-opens after (chalk/chalk#92). The façade computes parameters; the escape itself is emitted here and nowhere else (R3, R6).

function sgr(chain: readonly SgrPair[], s: string): string;
ParameterType
chainreadonly SgrPair[]
sstring

Returns string

Constants

command

const command: Token;

error

const error: Token;

flag

const flag: Token;

heading

const heading: Token;

hint

const hint: Token;

muted

const muted: Token;

ok

const ok: Token;

value

const value: Token;

warn

const warn: Token;

Interfaces

SgrPair

One SGR pair as the chalk façade composes them: the parameters that open and close it, no escape.

interface SgrPair {
    readonly open: string;
    readonly close: string;
}

Types

Token

type Token = (s: string) => string;

On this page