chx 0

Chalk wrapper for outputting text using HTML syntax

3 years after

chx Build Status

A wrapper on top of chalk to make outputting text on a terminal an HTML-like experience.

How to use

/** @jsx chx */
import chx from 'chx';

console.log(<p>
  Welcome to the <b>future</b>.<br />
  What's your <cyan>name</cyan>?<br />
  Hope you enjoy your <bg color="yellow">time here</bg>.
  More at <u>https://github.com/zeit/chx</u>.<br />
  <red>H</red><yellow>a</yellow><blue>v</blue><green>e</green>{' '}
  <cyan>f</cyan><white>u</white><magenta>n</magenta><bgRed>!</bgRed>
</p>);

and make sure the babel transform react-jsx is in place.

Built ins

  • All the colors, modifiers and bgColors from chalk are available as tags. For example: <bgRed>, <blue> and <italic>
  • The HTML shorthands are exposed when available:
    • <b> (bold)
    • <i> (italic)
    • <u> (underline)
    • <strike> (strikethrough)
  • A special <bg color> element is available as a shorthand.
  • <br /> as an alternative for {'\n'}
  • To wrap, we expose a few noop elements. Use whichever you like most:
    • <p>
    • <chx>
    • <span>

For more advanced terminal UI needs, check out react-blessed.

Related Repositories

DBTNG

DBTNG

The DBTNG database abstraction library for PHP ...

tick

tick

Tick, a market data tool. ...

vm-crash-course

vm-crash-course

Thiago's VM crash course ...

awesomerelationships

awesomerelationships

Notes from a discussion of an entity relationships module for Drupal 7. ...

journey-planner

journey-planner

GTFS based Journey Planner ...


Top Contributors

rauchg leo greenkeeperio-bot