Skip to content

Instantly share code, notes, and snippets.

@IUnknown68
Created May 21, 2017 12:47
Show Gist options
  • Save IUnknown68/89ea36472a2c9f0645bc970fabdb1003 to your computer and use it in GitHub Desktop.
Save IUnknown68/89ea36472a2c9f0645bc970fabdb1003 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.
(() => {
['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