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]
This commit is contained in:
Fabian Homborg 2018-12-05 09:52:36 +01:00
parent fa5f3fe9a0
commit 03bca5f7dd

View file

@ -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 = '';
}
var postData = "what=" + name + "&color=" + $scope.selectedColorScheme[name] + "&background_color=&bold=&underline=";
} else {
selected = $scope.selectedColorScheme[name];
}
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;