Created
July 3, 2017 20:24
-
-
Save etjossem/2a6c42eae7e1f1b1d8c72543d98cf879 to your computer and use it in GitHub Desktop.
Bishy.js -- make your terminal output sparkle!
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
// 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