Created
July 17, 2011 23:24
-
-
Save ydnax/1088232 to your computer and use it in GitHub Desktop.
colours the string of a number red if negative and green for positive. for bg=1 the background.
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
var clc = require('cli-color'); | |
var colkeys =new Array(2); | |
colkeys[0] =new Array(); | |
colkeys[1] =new Array(); | |
colkeys[0][0]=clc.red; | |
colkeys[0][1]=clc.green; | |
colkeys[1][0]=clc.bgRed; | |
colkeys[1][1]=clc.bgGreen; | |
exports.gCol=function(str, bg){ | |
return mat[bg?1:0][str[0]=='-'?0:1](str); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment