aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-10-16 23:26:51 -0400
committerJesse Luehrs <doy@tozt.net>2014-10-16 23:26:51 -0400
commit6916426b76f71d0c7a07483ed15332b41f680966 (patch)
tree8a59b9185c0cfdf05b1d7eef7befcf73a3da5528
parent5a4caea0c227f69d754acd182d0aa7db3f39804d (diff)
downloadpython-termcast-server-6916426b76f71d0c7a07483ed15332b41f680966.tar.gz
python-termcast-server-6916426b76f71d0c7a07483ed15332b41f680966.zip
handle inverse on redraws too
-rw-r--r--termcast_server/index.html28
1 files changed, 19 insertions, 9 deletions
diff --git a/termcast_server/index.html b/termcast_server/index.html
index f8ad94d..db2f191 100644
--- a/termcast_server/index.html
+++ b/termcast_server/index.html
@@ -309,17 +309,27 @@ socket.onmessage = function (e) {
term += '<tr>';
row.forEach(function (cell) {
term += '<td';
- if (cell.f != null || cell.b != null || cell.i || cell.u) {
+ if (cell.f != null || cell.b != null || cell.i || cell.u || cell.n) {
+ var fgcolor = cell.f;
+ var bgcolor = cell.b;
+ var inverse = cell.n;
term += ' style="';
- if (cell.f != null) {
- var fgcolor = cell.f;
- if (cell.o && fgcolor < 8) {
- fgcolor += 8;
- }
- term += 'color: ' + colors[fgcolor] + ';';
+ if (inverse && fgcolor == bgcolor) {
+ term += 'color: black;';
+ term += 'background-color: #d3d3d3;';
}
- if (cell.b != null) {
- term += 'background-color: ' + colors[cell.b] + ';';
+ else {
+ if (fgcolor != null) {
+ var style = inverse ? 'background-color' : 'color';
+ if (cell.o && fgcolor < 8) {
+ fgcolor += 8;
+ }
+ term += style + ': ' + colors[fgcolor] + ';';
+ }
+ if (bgcolor != null) {
+ var style = inverse ? 'color' : 'background-color';
+ term += style + ': ' + colors[bgcolor] + ';';
+ }
}
if (cell.i) {
term += 'font-style: italic;';