Last active
August 31, 2016 14:28
-
-
Save pfeilbr/ef5fb70f2c3a45f6e71370e3d000b8ed to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Text color codes: | |
// 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white | |
// see: http://webhome.csc.uvic.ca/~sae/seng265/fall04/tips/s265s047-tips/bash-using-colors.html | |
// '\u001b' is ESC (escape) | |
function color(s, c) { | |
return '\u001b[' + c + ';1m' + s + '\u001b[0m'; | |
} | |
const s = `Hello ${color('World', 32)}. How are you?` | |
console.log(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment