Skip to content

Instantly share code, notes, and snippets.

@pierrecholhot
Created March 30, 2018 11:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pierrecholhot/1dc519f56ef9bfe81fd1869ab4b54772 to your computer and use it in GitHub Desktop.
Save pierrecholhot/1dc519f56ef9bfe81fd1869ab4b54772 to your computer and use it in GitHub Desktop.
Styled console.log messages
function injectSneakyConsoleMessage(lines) {
if (!(window.console && window.console.log)) { return }
const styles = ['padding: 1em', 'line-height: 2', 'font-size: 2em', 'display: block', 'background: pink']
lines.forEach(line => window.console.log(`%c${line}`, styles.join(';')))
}
injectSneakyConsoleMessage(['The quick brown fox', 'jumps over the lazy dog'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment