Created
September 4, 2024 09:35
-
-
Save BorisAnthony/9bd9b7542c6a91fb9d4b812a8aff8015 to your computer and use it in GitHub Desktop.
Browser Console Styling
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
/** | |
From: | |
https://codepen.io/jscottsmith/pen/VLzMLo?editors=0010 | |
Post about console log styles: | |
http://jscottsmith.me/notes/styling-your-console-logs | |
**/ | |
// Styles and Colors | |
var colors = { | |
"gray": "font-weight: bold; color: #1B2B34;", | |
"red": "font-weight: bold; color: #EC5f67;", | |
"orange": "font-weight: bold; color: #F99157;", | |
"yellow": "font-weight: bold; color: #FAC863;", | |
"green": "font-weight: bold; color: #99C794;", | |
"teal": "font-weight: bold; color: #5FB3B3;", | |
"blue": "font-weight: bold; color: #6699CC;", | |
"purple": "font-weight: bold; color: #C594C5;", | |
"brown": "font-weight: bold; color: #AB7967;" | |
} | |
// All the colors | |
console.log('%cHello', colors.gray); | |
console.log('%cHello', colors.red); | |
console.log('%cHello', colors.orange); | |
console.log('%cHello', colors.yellow); | |
console.log('%cHello', colors.teal); | |
console.log('%cHello', colors.blue); | |
console.log('%cHello', colors.purple); | |
console.log('%cHello', colors.brown); | |
// Log with multiple colors | |
console.log('%cGray %cRed %cOrange %cYellow %cGreen %cTeal %cBlue %cPurple %cBrown', colors.gray, colors.red, colors.orange, colors.yellow, colors.green, colors.teal, colors.blue, colors.purple, colors.brown); | |
// Log that's partially colored and the rest is default styling | |
console.log('%cWarning: %cThe cake is a lie', colors.red, ''); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment