2.0.2 • Published 7 years ago

console-styles v2.0.2

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

About

console-styles is a module used for applying ANSI codes to strings, this allows for customized output/logging to the console/process.stdout. This module is very similar to chalk but it has no dependencies and there is much less code as it takes advantage of ES6 features, specifically the Proxy constructor. All styles and colours can be chained and then wrapped around a specific string.

Comes with some TypeScript definitions.

Install

--save is not necessary if you don't have a package.json.

npm install --save console-styles

Example

// require the module
const styler = require("console-styles");

// log red text to the console
console.log(styler.red("hola amigos"));

// log black text with cyan background to the console
console.log(styler.black.bgCyan("wow"));

// More freedom, allows for multiple styles in one line
console.log(styler.black.bgCyan("this is great Kappa", "hello"));

console.log(styler.red("nested", styler.blue("colours")));

Styles

All styles can be chained.

const styler = require("console-styles");

console.log(styler.reset("Removes styles"));
console.log(styler.bright("Makes text bold/bright"));
console.log(styler.bold("Makes text bold/bright"));
console.log(styler.dim("Darkens text"));
console.log(styler.underline("Underline text"));
console.log(styler.reverse("Inverse style"));
console.log(styler.inverse("Inverse style"));
console.log(styler.black("Black coloured text"));
console.log(styler.grey("Grey coloured text"));
console.log(styler.gray("Grey coloured text"));
console.log(styler.red("Red coloured text"));
console.log(styler.green("Green coloured text"));
console.log(styler.yellow("Yellow coloured text"));
console.log(styler.blue("Blue coloured text"));
console.log(styler.magenta("Magenta coloured text"));
console.log(styler.cyan("Cyan coloured text"));
console.log(styler.white("White coloured text"));
console.log(styler.bgBlack("Black background text", "multiple", "params"));
console.log(styler.bgRed("Red background text"));
console.log(styler.bgGreen("Green background text"));
console.log(styler.bgYellow("Yellow background text"));
console.log(styler.bgBlue("Blue background text"));
console.log(styler.bgMagenta("Magenta background text"));
console.log(styler.bgCyan("Cyan background text"));
console.log(styler.bgWhite("White background text"));
2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago