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 */
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 new_lightness = lightness + adjust
if (new_lightness > 1.0 || new_lightness < 0.0) {
@ -315,7 +315,7 @@ function text_color_for_color(color_str) {
}
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){

View File

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

View File

@ -2,6 +2,7 @@
<!-- ko with: color_picker -->
<span style="padding-left: 25px">Click to customize each color: </span><br>
<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 ng-style="{'background-color': color}" ng-repeat="color in sampleTerminalBackgroundColors" ng-click="changeTerminalBackgroundColor(color)"></div>
</div>
@ -21,7 +22,7 @@
<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 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>

View File

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