Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ansicolor-utils

Khaogamermain0115MIT0.0.2TypeScript support: included

A util for ANSI colors. Encoding and Decoding ANSI colors & more!

ansicolors, chalk, ansi, colors, colorutils, color-utils, color, color-util, colorutil

readme

ANSIColor-Util

ANSIColor-Util is a color util to get ANSI colors and decode ANSI colors to React Component.

Installation

Installing ANSIColor-Util

npm install ansicolor-util
# or
yarn install ansicolor-util

Usage/Examples

Coloring text.

import { red } from 'ansicolor-util'; // ESM
const { blue } = require('ansicolor-util'); // CommonJS

console.log(red("Hello, ") + blue("World", { bold: true, underline: true }))

Decoding ANSI Colors to React Component text.

import { Ansi } from 'ansicolor-util'; // ESM
const { Ansi } = require('ansicolor-util'); // CommonJS

const App = () => {
  return <>
    <Ansi>
      {`\x1b[31mThis is red text\x1b[0m`}
    </Ansi>
  </>
}

export default App;

Authors

License

GPL-3.0