From e25751c132e6477efd2f9866cbecfc057ec1d267 Mon Sep 17 00:00:00 2001 From: fakeyw Date: Fri, 3 Sep 2021 16:31:07 +0800 Subject: [PATCH 1/2] found the way to change font color --- webssh/static/js/main.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js index 8f1e7e1..480447e 100644 --- a/webssh/static/js/main.js +++ b/webssh/static/js/main.js @@ -56,7 +56,7 @@ jQuery(function($){ key_max_size = 16384, fields = ['hostname', 'port', 'username'], form_keys = fields.concat(['password', 'totp']), - opts_keys = ['bgcolor', 'title', 'encoding', 'command', 'term', 'fontsize'], + opts_keys = ['bgcolor', 'title', 'encoding', 'command', 'term', 'fontsize', 'fontcolor'], url_form_data = {}, url_opts_data = {}, validated_form_data, @@ -196,6 +196,11 @@ jQuery(function($){ }); } + function set_font_color(term, color) { + term.setOption('theme', { + foreground: color + }); + } function custom_font_is_loaded() { if (!custom_font) { @@ -363,7 +368,8 @@ jQuery(function($){ termOptions = { cursorBlink: true, theme: { - background: url_opts_data.bgcolor || 'black' + background: url_opts_data.bgcolor || 'black', + foreground: url_opts_data.fontcolor || 'white' } }; @@ -494,6 +500,10 @@ jQuery(function($){ set_backgound_color(term, color); }; + wssh.set_fontcolor = function(color) { + set_font_color(term, color); + }; + wssh.custom_font = function() { update_font_family(term); }; From 3192cb006c49b4af75994ccc109824753816da3b Mon Sep 17 00:00:00 2001 From: fakeyw Date: Fri, 3 Sep 2021 17:48:41 +0800 Subject: [PATCH 2/2] README add set_font_color example --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 3874705..ad77175 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,11 @@ Passing a terminal background color http://localhost:8888/#bgcolor=green ``` +Passing a terminal font color +```bash +http://localhost:8888/#fontcolor=red +``` + Passing a user defined title ```bash http://localhost:8888/?title=my-ssh-server