Skip to content

Commit

Permalink
Add CSS classes ansi-default-inverse-fg and ...-bg
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Oct 25, 2017
1 parent 0684645 commit ab7b19d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions notebook/static/base/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,21 +247,23 @@ define([
fg += 8; // Bold text uses "intense" colors
}
if (inverse) {
if (fg.length === 0) { fg = [0, 0, 0]; }
if (bg.length === 0) { bg = [255, 255, 255]; }
[fg, bg] = [bg, fg];
}

if (typeof fg === "number") {
classes.push(_ANSI_COLORS[fg] + "-fg");
} else if (fg.length) {
styles.push("color: rgb(" + fg + ")");
} else if (inverse) {
classes.push("ansi-default-inverse-fg");
}

if (typeof bg === "number") {
classes.push(_ANSI_COLORS[bg] + "-bg");
} else if (bg.length) {
styles.push("background-color: rgb(" + bg + ")");
} else if (inverse) {
classes.push("ansi-default-inverse-bg");
}

if (bold) {
Expand Down
3 changes: 3 additions & 0 deletions notebook/static/notebook/less/ansicolors.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
.ansicolors(cyan, #60C6C8, #258F8F);
.ansicolors(white, #C5C1B4, #A1A6B2);

.ansi-default-inverse-fg { color: #FFFFFF; }
.ansi-default-inverse-bg { background-color: #000000; }

.ansi-bold { font-weight: bold; }
.ansi-underline { text-decoration: underline; }

Expand Down

0 comments on commit ab7b19d

Please sign in to comment.