Created
February 2, 2017 09:19
-
-
Save maxfunke/f903a3dee1d556e4b768e60808942fe7 to your computer and use it in GitHub Desktop.
color codes for console.log() in javascript / Node.js
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
'use strict'; | |
let colorReset = "\x1b[0m"; //reset | |
let colorCode = (p) => { | |
if (p >= 100){ | |
return "\x1b[31m"; //red | |
} else if (p < 100 && p >= 90){ | |
return "\x1b[36m"; //cyan | |
} | |
return "\x1b[32m"; //green | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment