diff --git a/IPython/html/static/base/js/utils.js b/IPython/html/static/base/js/utils.js
index 6b731c1..de60240 100644
--- a/IPython/html/static/base/js/utils.js
+++ b/IPython/html/static/base/js/utils.js
@@ -290,27 +290,36 @@ IPython.utils = (function (IPython) {
function ansispan(str) {
// ansispan function adapted from github.com/mmalecki/ansispan (MIT License)
// regular ansi escapes (using the table above)
+ var is_open = false
return str.replace(/\033\[(0?[01]|22|39)?([;\d]+)?m/g, function(match, prefix, pattern) {
if (!pattern) {
// [(01|22|39|)m close spans
- return "";
- }
- // consume sequence of color escapes
- var numbers = pattern.match(/\d+/g);
- var attrs = {};
- while (numbers.length > 0) {
- _process_numbers(attrs, numbers);
- }
-
- var span = "";
+ } else {
+ return "";
+ }
+ } else {
+ is_open = true;
+
+ // consume sequence of color escapes
+ var numbers = pattern.match(/\d+/g);
+ var attrs = {};
+ while (numbers.length > 0) {
+ _process_numbers(attrs, numbers);
+ }
+
+ var span = "";
}
- return span + ">";
});
};
-
+
// Transform ANSI color escape codes into HTML tags with css
// classes listed in the above ansi_colormap object. The actual color used
// are set in the css file.
diff --git a/IPython/html/static/notebook/less/ansicolors.less b/IPython/html/static/notebook/less/ansicolors.less
index 05009fb..7f15301 100644
--- a/IPython/html/static/notebook/less/ansicolors.less
+++ b/IPython/html/static/notebook/less/ansicolors.less
@@ -1,13 +1,12 @@
/* CSS font colors for translated ANSI colors. */
-
.ansibold {font-weight: bold;}
/* use dark versions for foreground, to improve visibility */
.ansiblack {color: black;}
.ansired {color: darkred;}
.ansigreen {color: darkgreen;}
-.ansiyellow {color: brown;}
+.ansiyellow {color: #c4a000;}
.ansiblue {color: darkblue;}
.ansipurple {color: darkviolet;}
.ansicyan {color: steelblue;}
@@ -22,4 +21,3 @@
.ansibgpurple {background-color: magenta;}
.ansibgcyan {background-color: cyan;}
.ansibggray {background-color: gray;}
-
diff --git a/IPython/html/static/style/ipython.min.css b/IPython/html/static/style/ipython.min.css
index 93f2b40..173b54e 100644
--- a/IPython/html/static/style/ipython.min.css
+++ b/IPython/html/static/style/ipython.min.css
@@ -31,7 +31,7 @@ div.traceback-wrapper{text-align:left;max-width:800px;margin:auto}
.ansiblack{color:#000}
.ansired{color:#8b0000}
.ansigreen{color:#006400}
-.ansiyellow{color:#a52a2a}
+.ansiyellow{color:#c4a000}
.ansiblue{color:#00008b}
.ansipurple{color:#9400d3}
.ansicyan{color:#4682b4}
diff --git a/IPython/html/static/style/style.min.css b/IPython/html/static/style/style.min.css
index 1fa09c9..82ae512 100644
--- a/IPython/html/static/style/style.min.css
+++ b/IPython/html/static/style/style.min.css
@@ -1336,7 +1336,7 @@ input.engine_num_input{width:60px}
.ansiblack{color:#000}
.ansired{color:#8b0000}
.ansigreen{color:#006400}
-.ansiyellow{color:#a52a2a}
+.ansiyellow{color:#c4a000}
.ansiblue{color:#00008b}
.ansipurple{color:#9400d3}
.ansicyan{color:#4682b4}
diff --git a/IPython/html/tests/base/utils.js b/IPython/html/tests/base/utils.js
new file mode 100644
index 0000000..fe5c878
--- /dev/null
+++ b/IPython/html/tests/base/utils.js
@@ -0,0 +1,23 @@
+casper.notebook_test(function () {
+ var input = [
+ "\033[0m[\033[0minfo\033[0m] \033[0mtext\033[0m",
+ "\033[0m[\033[33mwarn\033[0m] \033[0m\tmore text\033[0m",
+ "\033[0m[\033[33mwarn\033[0m] \033[0m https://some/url/to/a/file.ext\033[0m",
+ "\033[0m[\033[31merror\033[0m] \033[0m\033[0m",
+ "\033[0m[\033[31merror\033[0m] \033[0m\teven more text\033[0m",
+ "\033[0m[\033[31merror\033[0m] \033[0m\t\tand more more text\033[0m"].join("\n");
+
+ var output = [
+ "[info] text",
+ "[warn] \tmore text",
+ "[warn] https://some/url/to/a/file.ext",
+ "[error] ",
+ "[error] \teven more text",
+ "[error] \t\tand more more text"].join("\n");
+
+ var result = this.evaluate(function (input) {
+ return IPython.utils.fixConsole(input);
+ }, input);
+
+ this.test.assertEquals(result, output, "IPython.utils.fixConsole() handles [0m correctly");
+});