To display colored text in Javascript, you can use the console.log()
function along with %c
format specifier. You can pass the color values as the second argument to the console.log()
function using a Template Literal expression that includes CSS style rules.
Here's an example code that displays the text in the colors you mentioned:
index.tsx284 chars4 lines
This will output the following in the console:
You can modify the CSS style rules as per your requirements.
gistlibby LogSnag