compromise
Version:
modest natural language processing
19 lines (16 loc) • 615 B
JavaScript
// Shared CLI colors and styles. Plain text when NO_COLOR is set, as the convention asks
const off = typeof process !== 'undefined' && Object.hasOwn(process.env || {}, 'NO_COLOR')
const color = code => s => (off ? s : '\x1b[' + code + 'm' + s + '\x1b[0m')
const green = color(32)
const red = color(31)
const blue = color(34)
const cyan = color(36)
const yellow = color(33)
// used by name, from the tagset colors
const magenta = color(35)
const dim = color(2)
const i = color(3)
const b = color(1)
const ul = color(4)
const grey = color(90)
export { green, red, blue, cyan, yellow, magenta, dim, i, b, ul, grey }