Socket
Socket
Sign inDemoInstall

ansi-html-community

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ansi-html-community

An elegant lib that converts the chalked (ANSI) text to HTML. (Community)


Version published
Weekly downloads
12M
decreased by-0.58%
Maintainers
1
Install size
20.5 kB
Created
Weekly downloads
 

Readme

Source

ansi-html NPM version Build Status

An elegant lib that converts the chalked (ANSI) text to HTML.

Coverage

  • All styles of chalk (100%) and colors.
  • There are over 150 randomized test cases under test.

Installation

$ npm install ansi-html-community

Usage

var ansiHTML = require('ansi-html-community');
var str = ansiHTML('[ANSI_TEXT]');

e.g.:

var chalk = require('chalk');

var str = chalk.bold.red('foo') + ' bar';
console.log('[ANSI]', str)
console.log('[HTML]', ansiHTML(str));

See complete examples under test / examples directory.

Set Colors

ansiHTML.setColors({
  reset: ['555', '666'], // FOREGROUND-COLOR or [FOREGROUND-COLOR] or [, BACKGROUND-COLOR] or [FOREGROUND-COLOR, BACKGROUND-COLOR]
  black: 'aaa',	// String
  red: 'bbb',
  green: 'ccc',
  yellow: 'ddd',
  blue: 'eee',
  magenta: 'fff',
  cyan: '999',
  lightgrey: '888',
  darkgrey: '777'
});

Reset

ansiHTML.reset();

Exposed Tags

var openTags = ansiHTML.tags.open;
var closeTags = ansiHTML.tags.close;

Test

$ npm install -l
$ npm test

Keywords

FAQs

Last updated on 05 Sep 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc