ansi-to-react
ANSI to React Elements
Last updated 5 years ago by captainsafia .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ansi-to-react 
SYNC missed versions from official npm registry.

ansi-to-react

This package convert ANSI escape codes to formatted text output for React.

Installation

$ yarn add ansi-to-react
$ npm install --save ansi-to-react

Usage

Basic

The example below shows how we can use this package to render a string with ANSI escape codes.

import Ansi from "ansi-to-react";

export function () => {
  return <Ansi>
    {'\u001b[34mhello world'}
  </Ansi>;
};

Will render:

<code>
  <span style="color:rgb(0, 0, 187)">hello world</span>
</code>

Classes

Style with classes instead of style attribute.

<Ansi useClasses>{"\u001b[34mhello world"}</Ansi>

Will render

<code>
  <span class="ansi-blue-fg">hello world</span>
</code>

Class Names

Font color Background Color
ansi-black-fg ansi-black-bg
ansi-red-fg ansi-red-bg
ansi-green-fg ansi-green-bg
ansi-yellow-fg ansi-yellow-bg
ansi-blue-fg ansi-blue-bg
ansi-magenta-fg ansi-magenta-bg
ansi-cyan-fg ansi-cyan-bg
ansi-white-fg ansi-white-bg
ansi-bright-black-fg
ansi-bright-red-fg
ansi-bright-green-fg
ansi-bright-yellow-fg
ansi-bright-blue-fg
ansi-bright-magenta-fg
ansi-bright-cyan-fg
ansi-bright-white-fg

Development

To develop on this project, fork and clone this repository on your local machine. Before making modifications, install the project's dependencies.

$ npm install

To run the test suite for this project, run:

$ npm test

Documentation

We're working on adding more documentation for this component. Stay tuned by watching this repository!

Support

If you experience an issue while using this package or have a feature request, please file an issue on the issue board,

License

BSD-3-Clause

Current Tags

  • 6.1.6                                ...           latest (5 years ago)
  • 6.0.5-alpha.0                                ...           prerelease (6 years ago)

67 Versions

  • 6.1.6                                ...           5 years ago
  • 6.1.5                                ...           5 years ago
  • 6.1.4                                ...           5 years ago
  • 6.1.3                                ...           5 years ago
  • 6.1.2                                ...           5 years ago
  • 6.1.1                                ...           5 years ago
  • 6.1.0                                ...           5 years ago
  • 6.0.10                                ...           5 years ago
  • 6.0.8                                ...           6 years ago
  • 6.0.7                                ...           6 years ago
  • 6.0.6                                ...           6 years ago
  • 6.0.5                                ...           6 years ago
  • 6.0.5-alpha.0                                ...           6 years ago
  • 6.0.4-alpha.0                                ...           6 years ago
  • 6.0.3                                ...           6 years ago
  • 6.0.3-alpha.0                                ...           6 years ago
  • 6.0.2-alpha.0                                ...           6 years ago
  • 6.0.1-alpha.0                                ...           6 years ago
  • 6.0.0                                ...           6 years ago
  • 5.1.4-alpha.0                                ...           6 years ago
  • 5.1.3-alpha.0                                ...           6 years ago
  • 5.1.2-alpha.0                                ...           6 years ago
  • 5.1.1                                ...           6 years ago
  • 5.1.1-alpha.0                                ...           6 years ago
  • 5.1.0                                ...           6 years ago
  • 5.0.0                                ...           7 years ago
  • 4.0.4                                ...           7 years ago
  • 4.0.4-alpha.0                                ...           7 years ago
  • 4.0.3-alpha.0                                ...           7 years ago
  • 4.0.2-alpha.0                                ...           7 years ago
  • 4.0.0-alpha.0                                ...           7 years ago
  • 3.3.5                                ...           7 years ago
  • 3.3.4                                ...           7 years ago
  • 3.3.3                                ...           8 years ago
  • 3.3.2                                ...           8 years ago
  • 3.3.1                                ...           8 years ago
  • 3.3.0                                ...           8 years ago
  • 3.2.1                                ...           8 years ago
  • 3.2.0                                ...           8 years ago
  • 3.1.0                                ...           8 years ago
  • 3.0.0                                ...           8 years ago
  • 2.0.6                                ...           8 years ago
  • 2.0.5                                ...           8 years ago
  • 2.0.4                                ...           8 years ago
  • 2.0.3                                ...           8 years ago
  • 2.0.2                                ...           8 years ago
  • 2.0.1                                ...           8 years ago
  • 2.0.0                                ...           9 years ago
  • 1.6.1                                ...           9 years ago
  • 1.6.0                                ...           9 years ago
  • 1.5.2                                ...           9 years ago
  • 1.5.1                                ...           9 years ago
  • 1.5.0                                ...           9 years ago
  • 1.4.2                                ...           9 years ago
  • 1.4.1                                ...           9 years ago
  • 1.4.0                                ...           9 years ago
  • 1.3.0                                ...           9 years ago
  • 1.2.0                                ...           9 years ago
  • 1.1.1                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
  • 0.0.6                                ...           9 years ago
  • 0.0.5                                ...           9 years ago
  • 0.0.4                                ...           10 years ago
  • 0.0.3                                ...           10 years ago
  • 0.0.1                                ...           10 years ago
  • 0.0.0                                ...           10 years ago

Copyright 2013 - present © cnpmjs.org | Home |