diff --git a/.gitignore b/.gitignore index 46322b8..658217d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ example.js node_modules +clor.js +yarn.lock diff --git a/.travis.yml b/.travis.yml index ae2f6b4..16d40f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: node_js node_js: + - 8 - 7 - 6 - 5 diff --git a/README.md b/README.md index ac91521..55cc32b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# clor +# Clor [![](http://img.shields.io/travis/jbucaran/clor.svg)](https://travis-ci.org/jbucaran/clor) [![](https://img.shields.io/npm/v/clor.svg)](https://www.npmjs.org/package/clor) @@ -6,70 +6,59 @@ Clor is a Node.js library for colorizing text using ANSI escape sequences. * **Safe**: Clor does not extend the [String.prototype](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/prototype). * **Simple**: Clor has no dependencies nor is it broken into a dozen tiny modules that only work well together. -* **It Just Works™**: Out of the box, Clor detects if your terminal supports colors and knows how to fail gracefully. +* **It Just Works™**: Out of the box, Clor detects if your terminal supports colors and knows how to fail with grace. ## Installation
-npm i -S clor
+npm i clor
 
## Usage + ```jsx const clor = require("clor") ``` +## Examples + Compose a color expression. + ```jsx console.log( - `${clor.red.bold("What's").newLine.inverse("up?")}` + `${clor.red.bold("What's").newLine.inverse("up?")}` ) ``` Concatenate expressions. + ```jsx console.log( - clor.red.bold("What's") + "\n" + clor.red.inverse("up?") + clor.red.bold("What's") + "\n" + clor.red.inverse("up?") ) ``` Nest expressions to reuse styles. + ```jsx console.log(`${clor.bold(clor.red("Bold & Red"))}`) ``` Create your own styles. + ```jsx const Styles = { - em: s => clor.bgBlack.yellow(s) + em(s) { + return clor.bgBlack.yellow(s) + } } - -console.log(Styles.em("Alert!")) ``` -And wrap them in a `clor()` or `clor.