Update use theme to create a font color

This commit is contained in:
brantje 2016-09-28 00:46:51 +02:00
parent af3c7b0b99
commit 2eb46ed9d7
7 changed files with 33 additions and 16 deletions

View file

@ -275,14 +275,14 @@
width: 100%; width: 100%;
border: 2px solid rgba(240, 240, 240, 0.9); border: 2px solid rgba(240, 240, 240, 0.9);
margin: 25px; margin: 25px;
-webkit-border-radius: 5px; -webkit-border-radius: 10px;
border-radius: 5px; border-radius: 10px;
background-clip: padding-box; background-clip: padding-box;
/* stops bg color from leaking outside the border: */ } /* stops bg color from leaking outside the border: */ }
#app-content #app-content-wrapper .grid-view .credential .credential_content { #app-content #app-content-wrapper .grid-view .credential .credential_content {
display: flex; display: flex;
padding: 2px;
flex-direction: column; flex-direction: column;
background-color: #fff;
width: 100%; width: 100%;
cursor: pointer; cursor: pointer;
font-size: 1.75em; font-size: 1.75em;
@ -291,11 +291,11 @@
padding-top: 0.5em; padding-top: 0.5em;
padding-left: 1em; padding-left: 1em;
padding-right: 1em; padding-right: 1em;
line-height: 1.3em; line-height: 1.3em; }
color: #ddd; }
#app-content #app-content-wrapper .grid-view .credential .credential_content .tags { #app-content #app-content-wrapper .grid-view .credential .credential_content .tags {
margin-bottom: 0.5em; } margin-bottom: 0.5em; }
#app-content #app-content-wrapper .grid-view .credential .credential_content .tags .tag { #app-content #app-content-wrapper .grid-view .credential .credential_content .tags .tag {
color: #000 !important;
margin-top: 5px; margin-top: 5px;
display: inline-block; } display: inline-block; }
@media all and (min-width: 40em) { @media all and (min-width: 40em) {

File diff suppressed because one or more lines are too long

View file

@ -8,18 +8,35 @@
*/ */
angular.module('passmanApp') angular.module('passmanApp')
.directive('useTheme', ['$window', function ($window) { .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 { return {
restrict: 'A', restrict: 'A',
scope:{ scope:{
type: '=type' type: '=type',
color: '='
}, },
link: function (scope, el, attr, ctrl) { link: function (scope, el, attr, ctrl) {
var _color = $('#header').css('background-color'); var _color = $('#header').css('background-color');
if(!scope.type) { if(!scope.type) {
$(el).css('background-color', _color); $(el).css('background-color', _color);
} else { } else {
$(el).css(scope.type, _color); $(el).css(scope.type, _color);
} }
if(scope.color){
$(el).css('color', invertColor(_color));
}
} }
}; };
}]); }]);

File diff suppressed because one or more lines are too long

View file

@ -158,11 +158,11 @@
width: 100%; width: 100%;
border: 2px solid rgba(240,240,240,.9); border: 2px solid rgba(240,240,240,.9);
margin: 25px; margin: 25px;
@include border-radius(5px); @include border-radius(10px);
.credential_content{ .credential_content{
display: flex; display: flex;
padding: 2px;
flex-direction: column; flex-direction: column;
background-color: #fff;
width: 100%; width: 100%;
cursor: pointer; cursor: pointer;
font-size: 1.75em; font-size: 1.75em;
@ -172,12 +172,11 @@
padding-left: 1em; padding-left: 1em;
padding-right: 1em; padding-right: 1em;
line-height: 1.3em; line-height: 1.3em;
color: #ddd;
} }
.tags{ .tags{
margin-bottom: 0.5em; margin-bottom: 0.5em;
.tag{ .tag{
color: #000 !important;
margin-top: 5px; margin-top: 5px;
display: inline-block; display: inline-block;
} }

View file

@ -19,7 +19,8 @@
<ul class="tab_header"> <ul class="tab_header">
<li ng-repeat="tab in tabs track by $index" class="tab" <li ng-repeat="tab in tabs track by $index" class="tab"
ng-class="{active:isActiveTab(tab)}" ng-class="{active:isActiveTab(tab)}"
ng-click="onClickTab(tab)">{{tab.title}} ng-click="onClickTab(tab)"
use-theme color="'true'">{{tab.title}}
</li> </li>
</ul> </ul>

View file

@ -79,8 +79,8 @@
<li class="credential" ng-repeat="credential in credentials | credentialSearch:filterOptions | tagFilter:selectedtags | orderBy:'label'| as:this:'filtered_credentials'" <li class="credential" ng-repeat="credential in credentials | credentialSearch:filterOptions | tagFilter:selectedtags | orderBy:'label'| as:this:'filtered_credentials'"
ng-if="credential.hidden == 0 && showCredentialRow(credential)" ng-if="credential.hidden == 0 && showCredentialRow(credential)"
ng-click="selectCredential(credential)" ng-click="selectCredential(credential)"
color-from-string="credential.label"> use-theme color="'true'">
<div class="credential_content" use-theme> <div class="credential_content" >
<div class="label">{{credential.label}}</div> <div class="label">{{credential.label}}</div>
<div class="tags"> <div class="tags">
<div class="tag" ng-repeat="tag in credential.tags_raw">{{tag.text}}</div> <div class="tag" ng-repeat="tag in credential.tags_raw">{{tag.text}}</div>