Socket
Socket
Sign inDemoInstall

colors

Package Overview
Dependencies
0
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    colors

get colors in your node.js console like what


Version published
Weekly downloads
16M
decreased by-1.78%
Maintainers
1
Created
Weekly downloads
 

Package description

What is colors?

The 'colors' npm package is used to add color and style to text in the Node.js console. It allows developers to easily format their console output by adding colors, background colors, and styles such as bold or underline to their text.

What are colors's main functionalities?

Text colors

This feature allows you to change the color of the text. You can use predefined color names to set the text color.

console.log('hello'.green); // Outputs green text

Background colors

Similar to text colors, this feature allows you to set the background color of the text using predefined color names.

console.log('hello'.bgGreen); // Outputs text with a green background

Text styles

This feature allows you to apply different styles to your text, such as making it bold, underlined, or dim.

console.log('hello'.bold); // Outputs bold text

Chaining multiple styles

You can chain multiple styles together to apply several formats to your text at once.

console.log('hello'.green.underline.bold); // Outputs green, underlined, bold text

Custom themes

You can define custom themes to create a combination of styles that can be reused throughout your application.

colors.setTheme({ custom: ['red', 'underline'] }); console.log('hello'.custom); // Outputs red underlined text

Other packages similar to colors

Readme

Source

colors.js - get color and style in your node.js console ( and browser ) like what

Installation

npm install colors

colors and styles!

  • bold
  • italic
  • underline
  • inverse
  • yellow
  • cyan
  • white
  • magenta
  • green
  • red
  • grey
  • blue
  • rainbow
  • zebra
  • random

Usage

var colors = require('./colors');

console.log('hello'.green); // outputs green text
console.log('i like cake and pies'.underline.red) // outputs red underlined text
console.log('inverse the color'.inverse); // inverses the color
console.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)

Creating Custom themes


var colors = require('colors');

colors.setTheme({
  silly: 'rainbow',
  input: 'grey',
  verbose: 'cyan',
  prompt: 'grey',
  info: 'green',
  data: 'grey',
  help: 'cyan',
  warn: 'yellow',
  debug: 'blue',
  error: 'red'
});

// outputs red text
console.log("this is an error".error);

// outputs yellow text
console.log("this is a warning".warn);

Contributors

Marak (Marak Squires) Alexis Sellier (cloudhead) mmalecki (Maciej Małecki) nicoreed (Nico Reed) morganrallen (Morgan Allen) JustinCampbell (Justin Campbell) ded (Dustin Diaz)

, Marak Squires , Justin Campbell, Dustin Diaz (@ded)

Keywords

FAQs

Last updated on 21 Aug 2013

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