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.
This lightweight npm package empowers you to effortlessly enhance your console logs with a variety of colors.
-
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.
To install the package, run the following command:
npm install console-log-in-color
- 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.
- Black
- Red
- Green
- Yellow
- Blue
- Magenta
- Cyan
- White
This package works in Node.js environments on terminals that support ANSI escape sequences.
We appreciate contributions from the community. Feel free to fork the repository and submit pull requests to enhance this package!
This project is distributed under the Apache 2.0 License.