Minor fixes in the colors tab

* Show color scheme title in preview box
* Show information about setting terminal background color on Apply
button mouse hover
* Added text_color_for_color method in colors controller scope
This commit is contained in:
Siteshwar Vashisht 2013-12-07 13:12:43 +05:30
parent 659541f4a5
commit 646180518a
4 changed files with 12 additions and 6 deletions

View file

@ -295,7 +295,7 @@ function adjust_lightness(color_str, func) {
/* Given a color, compute a "border color" for it that can show it selected */ /* Given a color, compute a "border color" for it that can show it selected */
function border_color_for_color(color_str) { function border_color_for_color(color_str) {
return $scope.adjust_lightness(color_str, function(lightness){ return adjust_lightness(color_str, function(lightness){
var adjust = .5 var adjust = .5
var new_lightness = lightness + adjust var new_lightness = lightness + adjust
if (new_lightness > 1.0 || new_lightness < 0.0) { if (new_lightness > 1.0 || new_lightness < 0.0) {
@ -315,7 +315,7 @@ function text_color_for_color(color_str) {
} }
return new_lightness return new_lightness
} }
return $scope.adjust_lightness(color_str, compute_constrast); return adjust_lightness(color_str, compute_constrast);
} }
function rgb_to_hsl(r, g, b){ function rgb_to_hsl(r, g, b){

View file

@ -26,6 +26,10 @@ controllers.controller("colorsController", function($scope, $http) {
$scope.terminalBackgroundColor = color; $scope.terminalBackgroundColor = color;
} }
$scope.text_color_for_color = function(color) {
return text_color_for_color(color);
}
$scope.getColorArraysArray = function() { $scope.getColorArraysArray = function() {
var result = null; var result = null;
if ( $scope.selectedColorScheme.colors && $scope.selectedColorScheme.colors.length > 0) if ( $scope.selectedColorScheme.colors && $scope.selectedColorScheme.colors.length > 0)

View file

@ -1,7 +1,8 @@
<div> <div>
<!-- ko with: color_picker --> <!-- ko with: color_picker -->
<span style="padding-left: 25px">Click to customize each color:</span><br> <span style="padding-left: 25px">Click to customize each color: </span><br>
<div class="colorpicker_text_sample" ng-style="{'background-color': terminalBackgroundColor}"> <div class="colorpicker_text_sample" ng-style="{'background-color': terminalBackgroundColor}">
<span style="position: absolute; left: 10px; top: -6px;" data-ng-style="{'color': text_color_for_color(selectedColorScheme.preferred_background || 'white')}">{{ selectedColorScheme.name }}</span><br>
<div class="color_picker_background_cells"> <div class="color_picker_background_cells">
<div ng-style="{'background-color': color}" ng-repeat="color in sampleTerminalBackgroundColors" ng-click="changeTerminalBackgroundColor(color)"></div> <div ng-style="{'background-color': color}" ng-repeat="color in sampleTerminalBackgroundColors" ng-click="changeTerminalBackgroundColor(color)"></div>
</div> </div>
@ -21,7 +22,7 @@
<br> <br>
<span data-ng-style="{ 'color': selectedColorScheme.command}" ng-click="selectColorSetting('command')">Th</span><span data-ng-style="{ 'color': selectedColorScheme.autosuggestion }" ng-click="selectColorSetting('autosuggestion')"><span class="fake_cursor"><span style="visibility: hidden">i</span></span>s is an autosuggestion</span> <span data-ng-style="{ 'color': selectedColorScheme.command}" ng-click="selectColorSetting('command')">Th</span><span data-ng-style="{ 'color': selectedColorScheme.autosuggestion }" ng-click="selectColorSetting('autosuggestion')"><span class="fake_cursor"><span style="visibility: hidden">i</span></span>s is an autosuggestion</span>
<span class="save_button" style="position: absolute; right: 5px; bottom: 5px;" data-ng-style="{'color': text_color_for_color(selectedColorScheme.preferred_background || 'white')}" ng-show="showSaveButton" ng-click="setTheme()">Apply</span> <span class="save_button" style="position: absolute; right: 5px; bottom: 5px;" title="Terminal background color is not set automatically on Apply. See your terminal documentation to set its background color." data-ng-style="{'color': text_color_for_color(selectedColorScheme.preferred_background || 'white')}" ng-show="showSaveButton" ng-click="setTheme()">Apply</span>
</div> </div>

View file

@ -318,8 +318,9 @@ class BindingParser:
# \[1\; is start of control sequence # \[1\; is start of control sequence
if c == '1': if c == '1':
self.get_char();self.get_char() self.get_char();c = self.get_char()
c = self.get_char() if c == ";":
c = self.get_char()
# 3 is Alt # 3 is Alt
if c == '3': if c == '3':