Last active
August 29, 2015 14:00
-
-
Save krrishd/11102454 to your computer and use it in GitHub Desktop.
console.swag - a small library to help style your console outputs with css properties
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
console.swag = function(item, style) { | |
var cStyle = | |
"line-height: " + "35px; " + | |
"padding: " + "10px; " + | |
"border-radius: " + "3px; " + | |
"background-color: " + (style.bg || "rgba(0,0,0,.8)") + "; " + | |
"color: " + (style.color || "white") + "; " + | |
"font-size: " + (style.fSize || "1.2em") + "; " + | |
"font: " + (style.font || "sans-serif") + "; " + | |
"text-shadow: " + "1px 1px 3px " + (style.tShadow || "rgba(0,0,0,1)"); | |
setTimeout(function() { | |
if(typeof item == "string") { | |
console.log("%c" + item, cStyle); | |
} | |
else { | |
console.log(item); | |
} | |
}, 100); | |
}; | |
/* Documentation | |
This small little library (?) lets you style your console. | |
To use the default styles, simply include this library and type in | |
console.swag("Whatever you want in the console", {}); | |
If you want to customize, here are the options: | |
console.swag("Whatever you want", {bg: "red", color: "white", fSize: "2em", font: "serif", "tShadow": "black"}); | |
bg = background-color | |
color = text color | |
fSize = font size | |
font = font (sans-serif, serif, monospace) | |
tShadow = color of text shadow | |
Have fun! - Krish (itskrish.co) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment