Skip to main content
Deno 2 is finally here 🎉️
Learn more

Install

import { rang } from "https://deno.land/x/rang@0.0.3/mod.js";

Usage

Rang comes with an easy to use composable API where you just chain and nest the styles you want.

import { rang } from "https://deno.land/x/rang@0.0.3/mod.js";
const log = console.log;


// Combine styled and normal strings
log(rang.blue('Hello') + ' World' + rang.red('!'));

// Compose multiple styles using the chainable API
log(rang.blue.bgRed.bold('Hello world!'));

// ES2015 template literal
log(`
CPU: ${rang.red('90%')}
RAM: ${rang.green('40%')}
DISK: ${rang.yellow('70%')}
`);

Modifiers

  • bold - Make text bold.
  • dim - Emitting only a small amount of light.
  • underline - Make text underline. (Not widely supported)
  • reverse- Inverse background and foreground colors.
  • hidden - Prints the text, but makes it invisible.

Colors

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • blackBright (alias: gray, grey)
  • redBright
  • greenBright
  • yellowBright
  • blueBright
  • magentaBright
  • cyanBright
  • whiteBright

Background colors

  • bgBlack
  • bgRed
  • bgGreen
  • bgYellow
  • bgBlue
  • bgMagenta
  • bgCyan
  • bgWhite
  • bgBlackBright (alias: bgGray, bgGrey)
  • bgRedBright
  • bgGreenBright
  • bgYellowBright
  • bgBlueBright
  • bgMagentaBright
  • bgCyanBright
  • bgWhiteBright