webconfig: Allow setting pager colors

This commit is contained in:
Fabian Homborg 2018-11-29 15:18:00 +01:00
parent a02eac5a7a
commit be1c022861
2 changed files with 13 additions and 3 deletions

View file

@ -119,7 +119,11 @@ controllers.controller("colorsController", function($scope, $http) {
"autosuggestion", "autosuggestion",
"user", "user",
"host", "host",
"cancel" "cancel",
"fish_pager_color_completion",
"fish_pager_color_description",
"fish_pager_color_prefix",
"fish_pager_color_progress"
]; ];
var remaining = settingNames.length; var remaining = settingNames.length;
for (name of settingNames) { for (name of settingNames) {

View file

@ -735,10 +735,16 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_set_color_for_variable(self, name, color, background_color, bold, def do_set_color_for_variable(self, name, color, background_color, bold,
underline): underline):
"Sets a color for a fish color name, like 'autosuggestion'"
if not color: if not color:
color = 'normal' color = 'normal'
"Sets a color for a fish color name, like 'autosuggestion'" varname = 'fish_color' + name
command = 'set -U fish_color_' + name # If the name already starts with "fish_", use it as the varname
# This is needed for 'fish_pager_color' vars.
if name.startswith('fish_'):
varname = name
# TODO: Check if the varname is allowable.
command = 'set -U ' + varname
if color: if color:
command += ' ' + color command += ' ' + color
if background_color: if background_color: