console-log-in-color
v1.0.3
Published
A npm package to console.log or print in desired color
Downloads
9
Readme
console-log-in-color
console-log-in-color
is a simple and lightweight npm package that allows you to add color to your console log messages in Node.js. It enhances the visibility and readability of your log messages by applying various colors.
Add a splash of colors to your Node.js console logs and outputs
This lightweight npm package empowers you to effortlessly enhance your console logs with a variety of colors.
Features
- Simple and Intuitive: The
changePrintColor
function provides a clear way to customize your console output. - Wide Range of Colors: Choose from 8 distinct colors (Black, Red, Green, Yellow, Blue, Magenta, Cyan, White) to highlight different messages.
- Cross-Platform Compatibility: Works seamlessly on various terminal environments that support ANSI escape sequences.
Installation
To install the package, run the following command:
npm install console-log-in-color
Usage
- Import the function
const { changePrintColor } = require('console-log-in-color');
- Customize your console output
changePrintColor("Green", "Success! The process completed successfully.");
changePrintColor("Red", "Error: An unexpected issue occurred.");
changePrintColor("Yellow", "Warning: Potential issue detected.");
changePrintColor("Blue", "Information: This is just a regular message.");
// ... and so on for other colors
- Executing the Code
node somefile.js
some file should be the name of the file you are using this package.
Available Colors
- Black
- Red
- Green
- Yellow
- Blue
- Magenta
- Cyan
- White
Compatibility
This package works in Node.js environments on terminals that support ANSI escape sequences.
Contributing
We appreciate contributions from the community. Feel free to fork the repository and submit pull requests to enhance this package!
License
This project is distributed under the Apache 2.0 License.