Created
April 25, 2024 07:22
-
-
Save stekhn/e1f2468a8e2db4826fbf73fdb87a09d6 to your computer and use it in GitHub Desktop.
Outputs an array of color strings to the browser console and colors each string according to its hexadecimal or RGB value for visual debugging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const consoleColorLog = (colors: string[]) => { | |
const strings = colors.map((color: string) => `%c${color}`).join(" "); | |
const css = colors.map((color: string) => `color: ${color};`); | |
console.log.apply(console, [strings, css].flat()); | |
}; | |
// consoleColorLog(["#FFFFFF", "#AFD1F9", "#6CA4FF", "#006AFF", "#0515CD"]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment