ansicolor-utils
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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

Package Sidebar

Install

npm i ansicolor-utils

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

26 kB

Total Files

10

Last publish

Collaborators

  • khaoisthebest