Skip to content

Instantly share code, notes, and snippets.

@etjossem
Created July 3, 2017 20:24
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 etjossem/2a6c42eae7e1f1b1d8c72543d98cf879 to your computer and use it in GitHub Desktop.
Save etjossem/2a6c42eae7e1f1b1d8c72543d98cf879 to your computer and use it in GitHub Desktop.
Bishy.js -- make your terminal output sparkle!
// Like chalk but more lightweight and I'm not going to break it by releasing 2.0.0.
var Bishy = function(color, msg) {
var colors = {
green: "\033[0;32m",
red: "\033[0;31m",
cyan: "\033[0;36m",
magenta: "\033[0;35m",
white: "\033[0;37m",
}
var end = "\033[0m";
if (color in colors) {
return colors[color] + msg + end;
} else {
return msg;
}
}
// Usage
console.log(Bishy("magenta", "Hello world."));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment