diff --git a/guacamole/src/main/webapp/app/form/controllers/terminalColorSchemeFieldController.js b/guacamole/src/main/webapp/app/form/controllers/terminalColorSchemeFieldController.js index d999cc6b5..d2ccbf04d 100644 --- a/guacamole/src/main/webapp/app/form/controllers/terminalColorSchemeFieldController.js +++ b/guacamole/src/main/webapp/app/form/controllers/terminalColorSchemeFieldController.js @@ -77,14 +77,12 @@ angular.module('form').controller('terminalColorSchemeFieldController', ['$scope // Keep selected color scheme and custom color scheme in sync with changes // to model $scope.$watch('model', function modelChanged(model) { - if (!model) - $scope.selectedColorScheme = ''; - else if (_.includes($scope.field.options, model)) - $scope.selectedColorScheme = model; - else { + if ($scope.selectedColorScheme === CUSTOM_COLOR_SCHEME || (model && !_.includes($scope.field.options, model))) { $scope.customColorScheme = ColorScheme.fromString(model); $scope.selectedColorScheme = CUSTOM_COLOR_SCHEME; } + else + $scope.selectedColorScheme = model || ''; }); // Keep model in sync with changes to selected color scheme diff --git a/guacamole/src/main/webapp/app/form/types/ColorScheme.js b/guacamole/src/main/webapp/app/form/types/ColorScheme.js index 587642698..f51a667f9 100644 --- a/guacamole/src/main/webapp/app/form/types/ColorScheme.js +++ b/guacamole/src/main/webapp/app/form/types/ColorScheme.js @@ -242,7 +242,7 @@ angular.module('form').factory('ColorScheme', [function defineColorScheme() { ColorScheme.toString = function toString(scheme) { // Use originally-provided string if it equates to the exact same color scheme - if (scheme._originalString && ColorScheme.equals(scheme, ColorScheme.fromString(scheme._originalString))) + if (!_.isUndefined(scheme._originalString) && ColorScheme.equals(scheme, ColorScheme.fromString(scheme._originalString))) return scheme._originalString; // Add background and foreground