coloristadeprecated

Terminal colouring tool

Usage no npm install needed!

<script type="module">
  import colorista from 'https://cdn.skypack.dev/colorista';
</script>

README

Logo of the project

Colorista · PRs Welcome

Terminal logging, benchmarking or simple debugging needs a colouring tool for aesthetic and readable purpose. We are presenting the supreme colouring tool that is easy to use in your code. It provides convenient syntax with the use of templated strings in JavaScript.

Installing & Getting started

Use NPM to install Colorista locally in your project, or globally in your system.

$ npm install colorista
$ npm install --global colorista

After installation you can require Colorista and start colouring your terminal output.

const colorista = require('colorista');

// Hello, World!
const helloWorld = colorista`${'Hello, World!'}`([
  { fg: 'black', bg: 'white', modifiers: ['b'] }
]);
console.log(helloWorld);

// Server log
const clientIP = '192.168.1.1';
const log = colorista`Сlient at ${clientIP} ${'connected'} to the server at ${new Date().toUTCString()}`([
  { fg: 'red', bg: 'white', modifiers: ['b'] },
  { fg: 'green', modifiers: ['b', 'i'] },
  { fg: 'cyan', modifiers: ['b', 'u'] }
]);
console.log(log);

Colorista supports the following foreground and background colours:

  • white
  • black
  • red
  • green
  • blue
  • yellow
  • magenta
  • cyan
  • gray
  • bright white
  • bright red
  • bright green
  • bright blue
  • bright yellow
  • bright magenta
  • bright cyan

As well as following styles:

  • b for bold
  • i for italic
  • u for underline
  • d for dim
  • s for strikethrough
  • c for conceal
  • n for inverse/negative