Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/passman.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrantje <brantje@gmail.com>2016-09-28 01:46:51 +0300
committerbrantje <brantje@gmail.com>2016-09-28 01:46:51 +0300
commit2eb46ed9d7a4b5be0906dfc1c0e19b042d46563a (patch)
tree32c19d28c716a5c12c4d6f15b73bdd5489644f41 /js/app/directives
parentaf3c7b0b99277ad64c89df34fd02e661994400c9 (diff)
Update use theme to create a font color
Diffstat (limited to 'js/app/directives')
-rw-r--r--js/app/directives/use-theme.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/js/app/directives/use-theme.js b/js/app/directives/use-theme.js
index 11b2254c..744776b3 100644
--- a/js/app/directives/use-theme.js
+++ b/js/app/directives/use-theme.js
@@ -8,18 +8,35 @@
*/
angular.module('passmanApp')
.directive('useTheme', ['$window', function ($window) {
+
+ function invertColor(hexTripletColor) {
+ var color = hexTripletColor;
+ color = color.substring(1); // remove #
+ color = parseInt(color, 16); // convert to integer
+ color = 0xFFFFFF ^ color; // invert three bytes
+ color = color.toString(16); // convert to hex
+ color = ("000000" + color).slice(-6); // pad with leading zeros
+ color = "#" + color; // prepend #
+ return color;
+ }
return {
restrict: 'A',
scope:{
- type: '=type'
+ type: '=type',
+ color: '='
},
link: function (scope, el, attr, ctrl) {
var _color = $('#header').css('background-color');
+
if(!scope.type) {
$(el).css('background-color', _color);
} else {
$(el).css(scope.type, _color);
}
+ if(scope.color){
+
+ $(el).css('color', invertColor(_color));
+ }
}
};
}]);