chjj/term.js — pull request #4 by gsamokovarov (2013-08-30 12:59:46+00:00)
Title: Fix {fore,back}ground when passing 18 colors

When you pass 18 colors, you expect the last two of them to be the background and the foreground. However, in the current implementation there is a bug with the filling to the 256th color, so the background and foreground colors end up being 2 places off of where you look for them.

Here is a little patch to `example/index.html` to demonstrate the problem.

```diff
diff --git i/example/index.html w/example/index.html
index ccac5f5..ce266d9 100644
--- i/example/index.html
+++ w/example/index.html
@@ -10,21 +10,19 @@
font: 20px/1.5 sans-serif;
}

-/*
.terminal {
float: left;
border: #000 solid 5px;
font-family: "DejaVu Sans Mono", "Liberation Mono", monospace;
font-size: 11px;
- color: #f0f0f0;
- background: #000;
+ color: #000;
+ background: #fff;
}

.terminal-cursor {
- color: #000;
- background: #f0f0f0;
+ color: #fff;
+ background: #000;
}
-*/

term.js

@@ -37,7 +35,26 @@
var term = new Terminal({
cols: 80,
rows: 24,
- useStyle: true,
+ colors: [
+ '#000000',
+ '#cd0000',
+ '#00cd00',
+ '#cdcd00',
+ '#0000ee',
+ '#cd00cd',
+ '#00cdcd',
+ '#e5e5e5',
+ '#7f7f7f',
+ '#ff0000',
+ '#00ff00',
+ '#ffff00',
+ '#5c5cff',
+ '#ff00ff',
+ '#00ffff',
+ '#ffffff',
+ '#ffffff',
+ '#000000'
+ ],
screenKeys: true
});

```