Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

color-properties

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

color-properties

extends string prototype with console styling using ANSI escape codes

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

color-properties

Extends the String prototype with color and text decoration attributes, allowing for easy styling of console output using ANSI escape codes.

Installation

npm install color-properties

Usage

First, import the colorize function:

const { colorize } = require('color-properties');

Next, run the colorize function to extend the String prototype with color and decoration properties:

colorize();

Alternatively you can also extend the string directly:

require('color-properties/colorize');

Now, you can use the color and decoration properties directly on string instances. Here's an example:

console.log('Hello World!'.green.bright); // prints "Hello World!" in green and bold style

Styles

The following styles are avainable:

  • reset
  • bright
  • dim
  • italic
  • underline
  • inverse
  • hidden
  • strikethrough
  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • gray
  • bgBlack
  • bgRed
  • bgGreen
  • bgYellow
  • bgBlue
  • bgMagenta
  • bgCyan
  • bgWhite
  • bgGray

Refer to the example for combining multiple properties.

License

MIT

Keywords

FAQs

Package last updated on 10 Jul 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc