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

chroma-palette

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chroma-palette

A light-weight utility for coloring your terminal. 0 dependencies. Default is a preselected color output from the 256 color palette, chosen to enhance legibility.

  • 1.0.3
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-44.44%
Maintainers
1
Weekly downloads
 
Created
Source

Chroma-Palette

A light-weight utility for coloring your terminal. 0 dependencies. Default is a preselected color output from the 256 color palette, chosen to enhance legibility.



Table of Contents

  1. Install
  2. Usage


Install

npm i chroma-palette 


Usage



Default (256-Color Set):

Default is a preselected color output from the 256 color palette, chosen to enhance legibility.

const chroma = require('chroma-palette')

// chaining
console.log(
  chroma.blue.whiteBg.bold.paint('Hello world!')
);
// combine
console.log(
  chroma.blue.paint('Hello ') + chroma.bold.paint('world') + '!'
);
// template literal
console.log(
  `${chroma.blue.paint('Hello')} ${chroma.bold.paint('world')}!`
);


16-Color Set Support:

If you need to alter the output of the colors to support the 16-color set.

const { Chroma } = require('chroma-palette')
// change profile to 16
const chroma = new Chroma({ profile:'16' })

// output will be the cyan from the 16-color palette
console.log(
  chroma.cyan.paint('Hello world!')
);


Custom-Color Set Support:

If you want to change the output of various colors.

const { Chroma } = require('chroma-palette')
// change any color by { [COLOR]:'[NUMBER FROM 256]' }
const chroma = new Chroma({ red:'196' })

// output will be the custom red chosen
console.log(
  chroma.red.paint('Hello world!')
);


View the 256 Color Palette:

Helpful when choosing custom colors.

const chroma = require('chroma-palette')

// output the 256-color palette
console.log(
  chroma.palette.paint()
);

Keywords

FAQs

Package last updated on 02 Feb 2022

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