Skip to content

Instantly share code, notes, and snippets.

@wonglok
Last active August 29, 2015 13:57
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 wonglok/9431797 to your computer and use it in GitHub Desktop.
Save wonglok/9431797 to your computer and use it in GitHub Desktop.
Console Image lgoo
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