From 3d98e5d947fdf0cc62c488e9ba820060b5d86415 Mon Sep 17 00:00:00 2001 From: Sheng Date: Fri, 17 May 2019 21:55:05 +0800 Subject: [PATCH] Support changing terminal background color --- webssh/static/js/main.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js index 2d85c16..c587edc 100644 --- a/webssh/static/js/main.js +++ b/webssh/static/js/main.js @@ -116,12 +116,20 @@ jQuery(function($){ return {'cols': cols, 'rows': rows}; } + function resize_terminal(term) { var geometry = current_geometry(term); term.on_resize(geometry.cols, geometry.rows); } + function set_backgound_color(term, color) { + term.setOption('theme', { + background: color + }); + } + + function format_geometry(cols, rows) { return JSON.stringify({'cols': cols, 'rows': rows}); } @@ -332,6 +340,10 @@ jQuery(function($){ } }; + wssh.set_bgcolor = function(color) { + set_backgound_color(term, color); + }; + term.on_resize = function(cols, rows) { if (cols !== this.cols || rows !== this.rows) { console.log('Resizing terminal to geometry: ' + format_geometry(cols, rows));