Skip to content
Browse files

check tty too

  • Loading branch information...
1 parent 3d41c2e commit d0f19251dcdaef6cd501a197fe6c21ae70827d67 @cmbuckley cmbuckley committed Oct 24, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 tinycolor.js
View
4 tinycolor.js
@@ -1,3 +1,5 @@
+var tty = require('tty');
+
var styles = {
'bold': ['\033[1m', '\033[22m'],
'italic': ['\033[3m', '\033[23m'],
@@ -24,7 +26,7 @@ var styles = {
'bgDefault': ['\033[49m', '\033[49m']
}
-var enabled = !process.env.NOCOLOR;
+var enabled = !process.env.NOCOLOR && tty.isatty(1) && tty.isatty(2);
Object.keys(styles).forEach(function(style) {
Object.defineProperty(String.prototype, style, {

0 comments on commit d0f1925

Please sign in to comment.
Something went wrong with that request. Please try again.