From 8ee3d8a9869a6dec3e5cde508371e08c315408e6 Mon Sep 17 00:00:00 2001 From: Le Minh Duc Date: Wed, 6 Nov 2019 14:29:58 +0700 Subject: [PATCH 1/2] replace octal number with hex number due to babel not allow them --- lib/ansi-color.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansi-color.js b/lib/ansi-color.js index 20fe35f..2f18e6e 100644 --- a/lib/ansi-color.js +++ b/lib/ansi-color.js @@ -32,9 +32,9 @@ function setColor(str,color) { var color_attrs = color.split("+"); var ansi_str = ""; for(var i=0, attr; attr = color_attrs[i]; i++) { - ansi_str += "\033[" + ANSI_CODES[attr] + "m"; + ansi_str += "\x27[" + ANSI_CODES[attr] + "m"; } - ansi_str += str + "\033[" + ANSI_CODES["off"] + "m"; + ansi_str += str + "\x27[" + ANSI_CODES["off"] + "m"; return ansi_str; } From 17b74ad5aeb5d81043f3e4bea99d2edb2a4de49b Mon Sep 17 00:00:00 2001 From: Le Minh Duc Date: Wed, 6 Nov 2019 14:34:58 +0700 Subject: [PATCH 2/2] fix: miss typing number --- lib/ansi-color.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansi-color.js b/lib/ansi-color.js index 2f18e6e..352b0f6 100644 --- a/lib/ansi-color.js +++ b/lib/ansi-color.js @@ -32,9 +32,9 @@ function setColor(str,color) { var color_attrs = color.split("+"); var ansi_str = ""; for(var i=0, attr; attr = color_attrs[i]; i++) { - ansi_str += "\x27[" + ANSI_CODES[attr] + "m"; + ansi_str += "\x1B[" + ANSI_CODES[attr] + "m"; } - ansi_str += str + "\x27[" + ANSI_CODES["off"] + "m"; + ansi_str += str + "\x1B[" + ANSI_CODES["off"] + "m"; return ansi_str; }