-
-
Save givingwu/70708c08f1461ea793cec6e91d2770d4 to your computer and use it in GitHub Desktop.
Adds color functions to the browser-console (e.g. console.green() or console.greenB() for bold-green. Simple and primitive.
This file contains hidden or 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
(() => { | |
['white', 'silver', 'gray', 'black', 'red', 'maroon', 'yellow', 'olive', 'lime', | |
'green', 'aqua', 'teal', 'blue', 'navy', 'fuchsia', 'purple' | |
].forEach(color => { | |
console[color] = (...args) => { | |
console.log(`%c${args.join(' ')}`, `color:${color}`) | |
} | |
console[`${color}B`] = (...args) => { | |
console.log(`%c${args.join(' ')}`, `color:${color};font-weight:bold`) | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment