Socket
Socket
Sign inDemoInstall

coloured

Package Overview
Dependencies
0
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    coloured

Pretty colours in your terminal.


Weekly downloads
713
increased by17.85%
Maintainers
0
Install size
6.60 kB
Created
Weekly downloads
 

Readme

Source

Coloured

Pretty colours in your terminal. This is a node.js port of defunkt's colored.

Colour.extendString()
console.log( "this is red".red() )
console.log( "this is red with a blue background (read: ugly)".red_on_blue() )
console.log( "this is red with an underline".red().underline() )
console.log( "this is really bold and really blue".bold().blue() )

Screenshot

For more examples see example/example.js.

Colours & Extras

As a convenience all colours and extras are available as methods on strings. Colours may be specified alone (e.g. red), or they may be specified with a background like so foreground_on_background (e.g. black_on_cyan).

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

Extras are used the same as colours.

  • clear
  • bold
  • underline
  • reverse

Installation

With npm: npm install coloured

With git: git clone git://github.com/gf3/coloured.git

API

When require'd this module returns a Colour object with the following methods and properties.

Methods

Colour.extendString( nativeProto ) → Undefined

  • native - Prototype to extend. Default: String.prototype.

Colour.colourise( string, options ) → String

  • string - String to be coloured. Required.
  • options - Object with any of the following properties: foreground, background, extra. Default: {}.

Colour.colour( name, background ) → String

  • name - Colour name (e.g. "red"). Required.
  • background - Set to true if background colour is desired. Default: false.

Colour.extra( name) → String

  • name - Extra name (e.g. "bold"). Required.

Properties

Colour.colours → Object Object containing colour names and values.

Colour.extras → Object Object containing extra names and values.

Author

Written by Gianni "gf3" Chiappettagf3.ca

License

Coloured is UNLICENSED.

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc