rainbow ~master

A terminal ascii colorizer for D programming language


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

PLEASE NOTE - This project is not being actively maintained at the moment - I am taking a break - not sure when I will return.

Rainbow

Pretty ANSI Colors for your terminal output.

logo

Install

using DUB:

  	"dependencies": {
          "rainbow":"~master"
	}

Supported Platforms

  • OSX
  • Unix

Windows support coming soon (maybe)

Usage

There are 3 items supported:

  • foreground color
  • background color
  • effects
import net.masterthought.rainbow;
import std.stdio;

void main(){
  writeln("Hello".rainbow.white.onCyan, " World!".rainbow.cyan.onWhite);
}

produces:

hello world

short cuts

You can use .colorName for foreground and .onColorName for background e.g.

 writeln("Hello".rainbow.red.onWhite);

You can use effects in the same way

  writeln("Hello".rainbow.green.onBlack.underlined.blink);

long hand

There are 3 methods you can call:

  • fg(FgColor color)
  • bg(BgColor color)
  • ef(Effect effect)
  writeln(Rainbow.apply(" Hello ").fg(FgColor.green).bg(BgColor.c221).ef(Effect.underlined));

Basic colors (foreground and background)

Colours are all on either the FgColor enum or the BgColor enum:

 FgColor.red
 BgColor.cyan

You can also use any of the colors from 0 to 255 (if supported on your system)

FgColor.c99
BgColor.c208

It's easy with shortcuts:

  writeln("hello".rainbow.c33.onC45);

note the upcased C when using the on notation.

The following basic colors are supported for foreground and background:

  • original
  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • lightGray
  • darkGray
  • lightRed
  • lightGreen
  • lightYellow
  • lightBlue
  • lightMagenta
  • lightCyan
  • white

Effects

The following effects are supported:

  • bold
  • dim
  • underlined
  • blink
  • inverted
  • hidden

References

Read this site to understand which colors and effects are available:

http://misc.flogisoft.com/bash/tipcolorsand_formatting

Authors:
  • Kingsley Hendrickse
Dependencies:
none
Versions:
0.0.2 2015-Mar-16
0.0.1 2015-Mar-11
~master 2017-Aug-13
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 601 downloads total

Score:
0.2
Short URL:
rainbow.dub.pm