webconfig: should know about italics, reverse, dim.

This commit is contained in:
Aaron Gyes 2018-12-05 01:05:33 -08:00
parent 03bca5f7dd
commit 04795eb8ea
2 changed files with 21 additions and 5 deletions

View file

@ -140,7 +140,7 @@ controllers.controller("colorsController", function($scope, $http) {
} else { } else {
selected = $scope.selectedColorScheme[name]; selected = $scope.selectedColorScheme[name];
} }
var postData = "what=" + name + "&color=" + selected + "&background_color=&bold=&underline="; var postData = "what=" + name + "&color=" + selected + "&background_color=&bold=&underline=&dim=&reverse=&italics=";
$http.post("set_color/", postData, { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config) { $http.post("set_color/", postData, { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config) {
if (status == 200) { if (status == 200) {
remaining -= 1; remaining -= 1;

View file

@ -137,7 +137,7 @@ def parse_color(color_str):
comps = color_str.split(' ') comps = color_str.split(' ')
color = 'normal' color = 'normal'
background_color = '' background_color = ''
bold, underline = False, False bold, underline, italics, dim, reverse = False, False, False, False, False
for comp in comps: for comp in comps:
# Remove quotes # Remove quotes
comp = comp.strip("'\" ") comp = comp.strip("'\" ")
@ -145,6 +145,12 @@ def parse_color(color_str):
bold = True bold = True
elif comp == '--underline': elif comp == '--underline':
underline = True underline = True
elif comp == '--italics':
italics = True
elif comp == '--dim':
dim = True
elif comp == '--reverse':
reverse = True
elif comp.startswith('--background='): elif comp.startswith('--background='):
# Background color # Background color
background_color = better_color( background_color = better_color(
@ -154,7 +160,7 @@ def parse_color(color_str):
color = better_color(color, parse_one_color(comp)) color = better_color(color, parse_one_color(comp))
return {"color": color, "background": background_color, "bold": bold, return {"color": color, "background": background_color, "bold": bold,
"underline": underline} "underline": underline, "italics": italics, "dim": dim, "reverse": reverse}
def parse_bool(val): def parse_bool(val):
@ -739,7 +745,7 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
return out return out
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, italics, dim, reverse):
"Sets a color for a fish color name, like 'autosuggestion'" "Sets a color for a fish color name, like 'autosuggestion'"
if not color: if not color:
color = 'normal' color = 'normal'
@ -758,6 +764,12 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
command += ' --bold' command += ' --bold'
if underline: if underline:
command += ' --underline' command += ' --underline'
if italics:
command += ' --italics'
if dim:
command += ' --dim'
if reverse:
command += ' --reverse'
out, err = run_fish_cmd(command) out, err = run_fish_cmd(command)
return out return out
@ -992,13 +1004,17 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
color = postvars.get('color') color = postvars.get('color')
background_color = postvars.get('background_color') background_color = postvars.get('background_color')
bold = postvars.get('bold') bold = postvars.get('bold')
italics = postvars.get('italics')
reverse = postvars.get('reverse')
dim = postvars.get('dim')
underline = postvars.get('underline') underline = postvars.get('underline')
if what: if what:
# Not sure why we get lists here? # Not sure why we get lists here?
output = self.do_set_color_for_variable( output = self.do_set_color_for_variable(
what[0], color[0], background_color[0], what[0], color[0], background_color[0],
parse_bool(bold[0]), parse_bool(underline[0])) parse_bool(bold[0]), parse_bool(underline[0]), parse_bool(italics[0]),
parse_bool(dim[0]), parse_bool(reverse[0]))
else: else:
output = 'Bad request' output = 'Bad request'
elif p == '/get_function/': elif p == '/get_function/':