Apply Custom Colors And Styles To Console Logs – console-colors

Category: Javascript , Recommended | September 24, 2018
Author:yairEO
Views Total:134 views
Official Page:Go to website
Last Update:September 24, 2018
License:MIT

Preview:

Apply Custom Colors And Styles To Console Logs – console-colors

Description:

console-colors is a JavaScript library that applies custom styles (bold, big, italic, capitalize, shadow) and colors to console logs.

How to use it:

Install & Import.

# NPM
$ npm install @yaireo/console-colors --save
import consoleColor from 'consoleColors';

Or load the JavaScript file ‘index.js’ in the document.

<script src="index.js"></script>

Initialize the console-colors.

const myLogger = consoleColor();
// or override the native console log
consoleColor( window.console )

Apply custom styles & colors to the console log. All preset colors:

  • white
  • black
  • silver
  • gray
  • red
  • green
  • blue
  • gold
  • yellow
  • pink
  • cyan
// Red Background + Shadow Effect + White Text
console.bgRed.shadow.white.log("Console log")

Apply a random background color to the console log.

// Random Background + Shadow Effect + White Text
console.bg.shadow.white.log("Console log")

Apply a random text color to the console log.

// Shadow Effect + Random Text Color
console.random.shadow.log("Console log")

You Might Be Interested In:


Leave a Reply