Skip to content

Instantly share code, notes, and snippets.

@idiomatic
Created May 12, 2022 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idiomatic/366f99d3f928d1fd242816303f19c6a0 to your computer and use it in GitHub Desktop.
Save idiomatic/366f99d3f928d1fd242816303f19c6a0 to your computer and use it in GitHub Desktop.
console.image = function(url, scale) {
scale = scale || 1;
var img = new Image();
img.onload = function() {
const width = this.width * scale;
const height = this.height * scale;
console.log("%c+", `font-size:1px; padding:${Math.floor(height/2)}px ${Math.floor(width/2)}px; line-height:${height}px; background: url(${url}); background-size:${width}px ${height}px; color: transparent;`);
};
img.src = url;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment