Output Colorful Logs In The Browser Console – Colorify.js

Category: Javascript | April 11, 2023
Views Total:74 views
Official Page:Go to website
Last Update:April 11, 2023


Output Colorful Logs In The Browser Console – Colorify.js


Colorify.js is a JavaScript library that makes use of ANSI escape codes to customize console log messages with unique colors and themes.

With the Colorify.js library, developers can quickly identify different types of messages or specific events based on their appearance. This improves the readability of console logs and enhances the overall debugging experience.

How to use it:

1. Import the ColorifyJS.

import ColorifyJS from "colorifyJS.js";

2. Initialize the ColorifyJS.

const log = ColorifyJS();

3. Apply predefined themes to the console logs.

// Alert
console.log(log.alert("Low client fps");
// Colorful
console.log(log.colorful("Hello, world!");
// Error
console.log(log.error("Something went wrong");
// Result
// Success
console.log(log.success("Email sent successfully!");

4. Apply a custom color to the console logs.

// Black
console.log(log.black("Hello, world!");
// Cyan
console.log(log.cyan("Hello, world!");
// Green
console.log(log.green("Hello, world!");
// Magenta
console.log(log.magenta("Hello, world!");
// Red
console.log(log.red("Hello, world!");
// White
console.log(log.white("Hello, world!");
// Yellow
console.log(log.yellow("Hello, world!");

You Might Be Interested In:

Leave a Reply