From 03bca5f7ddf974535cc9c66272406d2d05ae77e3 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 5 Dec 2018 09:52:36 +0100 Subject: [PATCH] webconfig: Fall back onto the default colorscheme The solarized themes now define pager colors, while other schemes don't. So if a user picks one of them, and then another, they'd keep the pager colors. Instead, since the default theme is now complete, any theme that does not define its own pager colors will always get the default ones. [ci skip] --- share/tools/web_config/js/controllers.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/share/tools/web_config/js/controllers.js b/share/tools/web_config/js/controllers.js index 01eed9d03..c1e14b8f8 100644 --- a/share/tools/web_config/js/controllers.js +++ b/share/tools/web_config/js/controllers.js @@ -127,12 +127,20 @@ controllers.controller("colorsController", function($scope, $http) { ]; var remaining = settingNames.length; for (name of settingNames) { + var selected; // Skip colors undefined in the current theme - if (!$scope.selectedColorScheme[name]) { - remaining -= 1; - continue; + // js is dumb - the empty string is false, + // but we want that to mean unsetting a var. + if (!$scope.selectedColorScheme[name] && $scope.selectedColorScheme[name] !== '') { + // Fall back onto the defaut colorscheme. + selected = color_scheme_fish_default[name]; + if (!selected && selected !== '') { + selected = ''; + } + } else { + selected = $scope.selectedColorScheme[name]; } - var postData = "what=" + name + "&color=" + $scope.selectedColorScheme[name] + "&background_color=&bold=&underline="; + var postData = "what=" + name + "&color=" + selected + "&background_color=&bold=&underline="; $http.post("set_color/", postData, { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config) { if (status == 200) { remaining -= 1;