JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
use a color palette sorta from tango
[watch-my-terminal.git] / index.html
index 6fb1473..718479e 100644 (file)
@@ -6,14 +6,23 @@
        <script src="/socket.io/socket.io.js"></script>
        <script>
                $(function() {
+                       var palette = [
+                               '2e3436',
+                               'a40000',
+                               '4e9a06',
+                               'c4a000',
+                               '3465a4',
+                               '75507b',
+                               'ce5c00',
+                               'babdb6',
+                       ];
                        var $body = $('body');
                        var socket = io.connect('http://localhost');
                        var color_to_css = function(i) {
-                               return 'color: #' +
-                                       ((i & 0xe0) ? 'ff' : '00') +
-                                       ((i & 0x1c) ? 'ff' : '00') +
-                                       ((i & 0x03) ? 'ff' : '00') +
-                                       '; ';
+                               return 'color: #' + palette[i] + '; ';
+                       }
+                       var bg_color_to_css = function(i) {
+                               return 'background-' + color_to_css(i);
                        }
                        var stylize = function (txt, style) {
                                if(txt.length == 0 || style == 0) {
@@ -25,7 +34,7 @@
                                if(style & 0x40000) css += 'text-decoration: underline; '; // blink
                                if(style & 0x80000) css += 'text-decoration: line-through; '; // invisible
                                if(style & 0x000ff) css += color_to_css(style & 0xff);
-                               if(style & 0x0ff00) css += 'background-' + color_to_css((style & 0xff00) >> 8);
+                               if(style & 0x0ff00) css += bg_color_to_css((style & 0xff00) >> 8);
                                return $('<span style="'+css+'"></span>').text(txt);
                        }
                        socket.on('init', function (v) {
@@ -54,8 +63,8 @@
        </script>
        <style>
                body {
-                       color: white;
-                       background: black;
+                       color: #babdb6;
+                       background: #2e3436;
                        font-family: monospace;
                        font-size: 12px;
                        line-height: 14px;