New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@comodinx/colors

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@comodinx/colors

@comodinx/colors is a Node.js string colors helpers.

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

@comodinx/colors

This is a simple proof of concept. An exercise.

We were inspired by and strongly recommend using colors

Installation

npm i @comodinx/colors

colors and styles!

text and bright text colors

colorbright
black
redbrightRed
greenbrightGreen
yellowbrightYellow
bluebrightBlue
magentabrightMagenta
cyanbrightCyan
whitebrightWhite
grey

background and bright background colors

colorbright
bgBlack
bgRedbgBrightRed
bgGreenbgBrightGreen
bgYellowbgBrightYellow
bgBluebgBrightBlue
bgMagentabgBrightMagenta
bgCyanbgBrightCyan
bgWhitebgBrightWhite
bgGrey

styles

style
reset
bold
dim
italic
underline
inverse
hidden
strikethrough

Usage

The super nifty way

require('@comodinx/colors');

console.log('hello'.green);
console.log('i like cake and pies'.underline.red);
console.log('inverse the color'.inverse);

or a slightly less nifty way which doesn't extend String.prototype

const colors = require('@comodinx/colors/safe');

console.log(colors.green('hello'));
console.log(colors.red(colors.underline('i like cake and pies')));
console.log(colors.inverse('inverse the color'));

Prevent extend String.prototype

COLORS_ON_STRING_PROTO=0 node myapp.js

Console.log string substitution

const name = 'Marak';
console.log(colors.green('Hello %s'), name);
// outputs -> 'Hello Marak'

Alias

const colors = require('@comodinx/colors');

colors.setAlias({
    title: 'bold',
    success: 'green',
    error: 'red',
    warn: 'yellow',
    info: 'cyan'
});

console.log('🟢  Congratulations'.success);
console.log('🔴  ERROR'.error);
console.log('🟡  ¡¡¡WARNING!!!'.warn);
console.log('🔵  This is an information message'.info);
console.log('This is a title for success message'.title.success);

Keywords

ansi

FAQs

Package last updated on 16 May 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