diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-16 22:36:23 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-16 22:36:23 -0400 |
commit | b735a5defa5d03ba16814c2ff4aaa116296539c2 (patch) | |
tree | c6a7b066017c8c0eb1cebb1e66be8724f97ae913 | |
parent | 7380e94b187b4284cf1edbd3062a9501eccfe9c9 (diff) | |
download | python-termcast-server-b735a5defa5d03ba16814c2ff4aaa116296539c2.tar.gz python-termcast-server-b735a5defa5d03ba16814c2ff4aaa116296539c2.zip |
make bold do bright colors, not bold
-rw-r--r-- | termcast_server/index.html | 27 | ||||
-rw-r--r-- | termcast_server/termcast.py | 6 |
2 files changed, 19 insertions, 14 deletions
diff --git a/termcast_server/index.html b/termcast_server/index.html index 6b72eb1..2550776 100644 --- a/termcast_server/index.html +++ b/termcast_server/index.html @@ -309,17 +309,18 @@ socket.onmessage = function (e) { term += '<tr>'; row.forEach(function (cell) { term += '<td'; - if (cell.fgcolor != null || cell.bgcolor != null || cell.bold || cell.italic || cell.underline) { + if (cell.fgcolor != null || cell.bgcolor != null || cell.italic || cell.underline) { term += ' style="'; if (cell.fgcolor != null) { - term += 'color: ' + colors[cell.fgcolor] + ';'; + var fgcolor = cell.fgcolor; + if (cell.bold && fgcolor < 8) { + fgcolor += 8; + } + term += 'color: ' + colors[fgcolor] + ';'; } if (cell.bgcolor != null) { term += 'background-color: ' + colors[cell.bgcolor] + ';'; } - if (cell.bold) { - term += 'font-weight: bold;'; - } if (cell.italic) { term += 'font-style: italic;'; } @@ -357,7 +358,13 @@ socket.onmessage = function (e) { } if (update.cell.hasOwnProperty('fgcolor')) { if (update.cell.fgcolor != null) { - td.style.setProperty('color', colors[update.cell.fgcolor]); + var fgcolor = update.cell.fgcolor; + if (update.cell.hasOwnProperty('bold')) { + if (update.cell.bold && fgcolor < 8) { + fgcolor += 8; + } + } + td.style.setProperty('color', colors[fgcolor]); } else { td.style.removeProperty('color'); @@ -371,14 +378,6 @@ socket.onmessage = function (e) { td.style.removeProperty('background-color'); } } - if (update.cell.hasOwnProperty('bold')) { - if (update.cell.bold) { - td.style.setProperty('font-weight', 'bold'); - } - else { - td.style.removeProperty('font-weight'); - } - } if (update.cell.hasOwnProperty('italic')) { if (update.cell.italic) { td.style.setProperty('font-style', 'italic'); diff --git a/termcast_server/termcast.py b/termcast_server/termcast.py index b9abb37..8b6935d 100644 --- a/termcast_server/termcast.py +++ b/termcast_server/termcast.py @@ -114,6 +114,12 @@ class Handler(object): if cur_cell[key] != prev_cell[key]: cell_changes[key] = cur_cell[key] + if "bold" in cell_changes: + cell_changes["fgcolor"] = cur_cell["fgcolor"] + + if "fgcolor" in cell_changes: + cell_changes["bold"] = cur_cell["bold"] + return cell_changes def total_time(self): |