textcolorizer
v1.0.4
Published
Downloads
13
Maintainers
Readme
TextColorizer
A simple package for adding colored text to the console log. Currently working only on React Projects.
Installation
Install the package using npm:
npm install textcolorizer
Usage
Import the Log
class from the textcolorizer
package and use its methods to add colored text to the console log.
import { Log } from 'textcolorizer'
function App() {
useEffect(()=>{
// Success message in green color
Log.success('Operation successful.');
// Error message in red color
Log.danger('An error occurred.');
// Information message with black text on yellow background
Log.info('Please note the following information.');
// Customised color message 1st parameter is the mesg 2nd parameter is the font color and 3rd is the background color
Log.customColor("Custom message","blue","grey");
// Make the font weight bold
Log.bold("The font is now bold");
// Italic font
Log.italic("The font is now Italic");
},[])
return (
<div className="App">
<h1>Welcome to TextColorizer</h1>
</div>
);
}
The Log class provides the following methods:
success(msg: string)
: Displays the msg parameter in green color.danger(msg: string)
: Displays the msg parameter in red color.info(msg: string)
: Displays the msg parameter with black text on a yellow background.
Feel free to customize the colors and styles in the Log class according to your preferences.
Contributing
Contributions are welcome! If you encounter any issues or would like to suggest improvements, please submit a pull request or create an issue on the GitHub repository.