Last active
August 29, 2015 13:57
-
-
Save wonglok/9431797 to your computer and use it in GitHub Desktop.
Console Image lgoo
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
function consoleLogo(width,height,url,comment){ | |
'use strict'; | |
//config | |
var lineHeight = 14; | |
//build string | |
var str = ''; | |
//str += ' border: red solid 1px; '; | |
str += ' font-size: '+lineHeight+'; '; | |
str += ' margin-top: 20px; '; | |
str += ' margin-bottom: 20px; '; | |
str += ' line-height: '+lineHeight+'px; '; | |
str += ' padding-top: '+height+'px; '; | |
str += ' padding-left: '+width+'px; '; | |
str += ' background:url("'+url+'"); '; | |
str += ' background-position: top center; '; | |
str += ' background-repeat:no-repeat; '; | |
var lines = '\n'; | |
var extraLines = (height/lineHeight)-1; | |
if (extraLines > 1){ | |
for(var i = 0; i <= extraLines; i++){ | |
lines += '\n'; | |
} | |
} | |
console.log(lines+"%c", str); | |
if (comment){ | |
return comment; | |
} | |
return ''; | |
} | |
consoleLogo( | |
200, | |
100, | |
'http://placehold.it/200x100', | |
'WONGLOK.com' | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment