Commit c543ddab c543ddabe77a7a1e1562be14853935e0462b709e by Nicolas Perriault

Merge pull request #491 from renatodarrigo/patch-1

refs #490 - checking for ANSICON on colorizer.js to have colors on Windows
2 parents 56dce225 10af8659
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
33 var require = patchRequire(require); 33 var require = patchRequire(require);
34 var fs = require('fs'); 34 var fs = require('fs');
35 var utils = require('utils'); 35 var utils = require('utils');
36 var env = require('system').env;
36 37
37 exports.create = function create(type) { 38 exports.create = function create(type) {
38 "use strict"; 39 "use strict";
...@@ -79,7 +80,7 @@ var Colorizer = function Colorizer() { ...@@ -79,7 +80,7 @@ var Colorizer = function Colorizer() {
79 * @return String 80 * @return String
80 */ 81 */
81 this.colorize = function colorize(text, styleName, pad) { 82 this.colorize = function colorize(text, styleName, pad) {
82 if (fs.isWindows() || !(styleName in styles)) { 83 if ((fs.isWindows() && !env['ANSICON']) || !(styleName in styles)) {
83 return text; 84 return text;
84 } 85 }
85 return this.format(text, styles[styleName], pad); 86 return this.format(text, styles[styleName], pad);
...@@ -93,7 +94,7 @@ var Colorizer = function Colorizer() { ...@@ -93,7 +94,7 @@ var Colorizer = function Colorizer() {
93 * @return String 94 * @return String
94 */ 95 */
95 this.format = function format(text, style, pad) { 96 this.format = function format(text, style, pad) {
96 if (fs.isWindows() || !utils.isObject(style)) { 97 if ((fs.isWindows() && !env['ANSICON']) || !utils.isObject(style)) {
97 return text; 98 return text;
98 } 99 }
99 var codes = []; 100 var codes = [];
......