0.0.8 • Published 3 years ago

ansi-html-community v0.0.8

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

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
webpack-dev-serverwebpack-hot-middleware@pmmmwh/react-refresh-webpack-plugincomponennenttlevibestliblevibestlib2levilibtest19levilibtest24levilibtest25levilibtest26levilibtest27levilibtest28levilibtest29@infinitebrahmanuniverse/nolb-anscclibyarntest@saaspe/componentshyperpass-sdksklif-ui-kitsklif-api@everything-registry/sub-chunk-1143@314oner_npm/universal-components-libraryp149-tablesklif-uisf-web-componentsreyhan-projectresponsis-gantt-task-reactreshow-appstories-fsreact-ang-notifications-honey-comb-setupreact-refresh-x-webpack-pluginreact-lightbox-pack-18supportpolyglot-component-libraryprasadacmreact-form-component-libraryreact-component-fresh-webpack-pluginreactofy-css-libraryreact-solid-gradient-pickertinymce-plugin-toytingzi-vuepressstyle-guide-mainsummerseatestltestweblibapisvelte-component-libtaman-baca-masyarakatnextjs-storiesemily-webpackdynamic-ui-practicefn-lib-examplefake-webpack-hot-middlewaregenerator-bootstrap-boilerplate-templatemj4d-excalidraw-originalmd-vditormavectramultiplatformlevimicroend-componentmy-webpack-number-test-demolitepie-datepicker-gabeimage-storiesnewdemo1nikochin.fork.webpack-hot-middlewarenka-gantt-task-reactnode-arcadymy-library-buttonleadengagelevikotlinliblevikotlintestlevilibtest15levilibtest16levilibtest17levilibtest18levilibtest21levilibtest22levilibtest23levimultiplatform10levimultiplatformtestlevimultitesthello_test_my_webpackjulien-easy-modalmynancep147-tablep148-tableparis-nord-estparvan_componentsparvan_reactjs_componentsnovacap-componentsns-dropdown-menupickupbiz-npm-packagepiral-cli-webpack5pm-gallery@zhangchongzhi/webpackcrud-duickcrm-1.0.1cssesc-wbgcustom-roulettecustome-package-amin@hippy/debug-server@hippy/hippy-react-refresh-webpack-plugin@darwishdev/dash-dev@dimcheify/dimui@gatsbyjs/webpack-hot-middleware
0.0.8

3 years ago