This module provides a set of functions for logging messages to the console with customizable styles, including support for different text and background colors in HEX, RGB, and HSL formats.
Installation
Ensure you have the chalk library installed in your project:
client.m.custom("Custom message with HEX color","#ff5733","#333", { bold:true, strikethrough:true });client.m.custom("Custom message with RGB color","rgb(255,0,0)","rgb(0,0,0)", { italic:true });client.m.custom("Custom message with HSL color","hsl(120,100%,50%)","hsl(240,100%,50%)", { underline:true });
Customization Options
All methods accept an options object for additional text styling:
bold: Makes the text bold.
underline: Underlines the text.
italic: Italicizes the text.
strikethrough: Strikes through the text.
Example
client.m.success("Operation successful!", { bold:true, underline:true });client.m.danger("Error occurred!", { italic:true });client.m.warning("This is a warning!", { bold:true });client.m.info("Just some information.", { underline:true });client.m.custom("Custom message with HEX color","#ff5733","#333", { bold:true, strikethrough:true });client.m.custom("Custom message with RGB color","rgb(255,0,0)","rgb(0,0,0)", { italic:true });client.m.custom("Custom message with HSL color","hsl(120,100%,50%)","hsl(240,100%,50%)", { underline:true });
Error Handling
The custom method will throw an error if an invalid color format is provided. Valid formats include HEX (#RRGGBB or #RGB), RGB (rgb(255, 255, 255)), and HSL (hsl(360, 100%, 50%)).
Example of Invalid Color Error:
client.m.custom("Invalid color format example","invalid-color","#000");// Throws: Error: Invalid color format. Please use HEX, RGB, or HSL.