diff --git a/share/tools/web_config/js/colorutils.js b/share/tools/web_config/js/colorutils.js index 2f009a5a3..7a319cb6f 100644 --- a/share/tools/web_config/js/colorutils.js +++ b/share/tools/web_config/js/colorutils.js @@ -192,34 +192,35 @@ function master_color_for_color(color_str) { } /* Given a color name, like 'normal' or 'red' or 'FF00F0', return an RGB color string (or empty - string) */ + string). If multiple colors are given, as in '555 brblack', interpret the first color. */ function interpret_color(str) { - str = str.toLowerCase(); - if (str == 'black') return '000000'; - if (str == 'red') return '800000'; - if (str == 'green') return '008000'; - if (str == 'brown') return '725000'; - if (str == 'yellow') return '808000'; - if (str == 'blue') return '000080'; - if (str == 'magenta') return '800080'; - if (str == 'purple') return '800080'; - if (str == 'cyan') return '008080'; - if (str == 'white') return 'c0c0c0'; - if (str == 'grey') return 'e5e5e5'; - if (str == 'brgrey') return '555555'; - if (str == 'brblack') return '808080'; - if (str == 'brred') return 'ff0000'; - if (str == 'brgreen') return '00ff00'; - if (str == 'brbrown') return 'ffff00'; - if (str == 'bryellow') return 'ffff00'; - if (str == 'brblue') return '0000ff'; - if (str == 'brmagenta') return 'ff00ff'; - if (str == 'brpurple') return 'ff00ff'; - if (str == 'brcyan') return '00ffff'; - if (str == 'brwhite') return 'ffffff'; + if (!str) return ''; + str = str.toLowerCase().split(" ")[0]; + if (str == 'black') return '#000000'; + if (str == 'red') return '#800000'; + if (str == 'green') return '#008000'; + if (str == 'brown') return '#725000'; + if (str == 'yellow') return '#808000'; + if (str == 'blue') return '#000080'; + if (str == 'magenta') return '#800080'; + if (str == 'purple') return '#800080'; + if (str == 'cyan') return '#008080'; + if (str == 'white') return '#c0c0c0'; + if (str == 'grey') return '#e5e5e5'; + if (str == 'brgrey') return '#555555'; + if (str == 'brblack') return '#808080'; + if (str == 'brred') return '#ff0000'; + if (str == 'brgreen') return '#00ff00'; + if (str == 'brbrown') return '#ffff00'; + if (str == 'bryellow') return '#ffff00'; + if (str == 'brblue') return '#0000ff'; + if (str == 'brmagenta') return '#ff00ff'; + if (str == 'brpurple') return '#ff00ff'; + if (str == 'brcyan') return '#00ffff'; + if (str == 'brwhite') return '#ffffff'; if (str == 'normal') return ''; if (str == 'reset') return ''; - return str + return '#' + str } var color_scheme_fish_default = { diff --git a/share/tools/web_config/js/controllers.js b/share/tools/web_config/js/controllers.js index ad7610075..0fca3cbf0 100644 --- a/share/tools/web_config/js/controllers.js +++ b/share/tools/web_config/js/controllers.js @@ -34,6 +34,8 @@ controllers.controller("colorsController", function($scope, $http) { $scope.border_color_for_color = border_color_for_color; + $scope.interpret_color = interpret_color; + $scope.getColorArraysArray = function() { var result = null; if ( $scope.selectedColorScheme.colors && $scope.selectedColorScheme.colors.length > 0) @@ -165,7 +167,6 @@ controllers.controller("promptController", function($scope, $http) { $scope.fetchSamplePrompts= function() { $http.get("sample_prompts/").then(function(arg) { $scope.samplePrompts = arg.data; - $scope.samplePromptsArrayArray = get_colors_as_nested_array($scope.samplePrompts, 1); if ($scope.selectedPrompt == null) { $scope.selectPrompt($scope.samplePrompts[0]); diff --git a/share/tools/web_config/partials/colors.html b/share/tools/web_config/partials/colors.html index 3c704c0a7..f8e44510e 100644 --- a/share/tools/web_config/partials/colors.html +++ b/share/tools/web_config/partials/colors.html @@ -14,43 +14,43 @@ fish cannot change the background color of your terminal. Refer to your terminal /bright/vixens jump | dozy "fowl" > quack &
@@ -58,13 +58,13 @@ fish cannot change the background color of your terminal. Refer to your terminal echo 'Errors are the portals to discovery
@@ -72,7 +72,7 @@ fish cannot change the background color of your terminal. Refer to your terminal # This is a comment
@@ -80,13 +80,13 @@ fish cannot change the background color of your terminal. Refer to your terminal This is an autosuggestion @@ -110,8 +110,8 @@ fish cannot change the background color of your terminal. Refer to your terminal - @@ -130,20 +130,20 @@ fish cannot change the background color of your terminal. Refer to your terminal
- /bright/vixens - jump - | - dozy - "fowl" - > quack - & + /bright/vixens + jump + | + dozy + "fowl" + > quack + &
- echo - 'Errors are the portals to discovery + echo + 'Errors are the portals to discovery
- # This is a comment + # This is a comment
- This is an autosuggestion + This is an autosuggestion
-
+
+