white red black; cyan green yellow; black blue white in javascript

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.tsx
console.log("%cWhite Red Black", "color: white; background-color: red; font-weight: bold;");
console.log("%cCyan Green Yellow", "color: cyan; background-color: green; font-weight: bold;");
console.log("%cBlack Blue White", "color: black; background-color: blue; font-weight: bold;");
284 chars
4 lines

This will output the following in the console:

Colored Text Output

You can modify the CSS style rules as per your requirements.

gistlibby LogSnag