Skip to content

Commit

Permalink
found the way to change font color
Browse files Browse the repository at this point in the history
  • Loading branch information
fakeyw committed Sep 3, 2021
1 parent ddbb2c3 commit e25751c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions webssh/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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'
}
};

Expand Down Expand Up @@ -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);
};
Expand Down

0 comments on commit e25751c

Please sign in to comment.