Skip to content

Instantly share code, notes, and snippets.

@icodeforlove
Created July 15, 2015 20:30
Show Gist options
  • Select an option

  • Save icodeforlove/34006e1f84cf06efd503 to your computer and use it in GitHub Desktop.

Select an option

Save icodeforlove/34006e1f84cf06efd503 to your computer and use it in GitHub Desktop.
String rgb support for console
String.prototype.rgb = function (r, g, b) {
return "\x1b[38;2;" + r + ";" + g + ";" + b + "m" + this + "\x1b[0m";
};
@icodeforlove
Copy link
Author

console.log('hello'.rgb(255,87,0) + 'world'.rgb(220,33,44));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment