contrast text color on buttons

This commit is contained in:
Antelle 2015-10-31 09:15:17 +03:00
parent b4adfcb9df
commit be491aee52
3 changed files with 9 additions and 3 deletions

View File

@ -14,6 +14,12 @@ $(function() {
return;
}
KeyHandler.init();
var appModel = new AppModel();
if (appModel.settings.get('theme')) {
document.body.setAttribute('class', 'th-' + appModel.settings.get('theme'));
}
if (['https:', 'file:', 'app:'].indexOf(location.protocol) < 0) {
Alerts.error({ header: 'Not Secure!', icon: 'user-secret', esc: false, enter: false, click: false,
body: 'You have loaded this app with insecure connection. ' +
@ -31,7 +37,6 @@ $(function() {
}
function showApp() {
var appModel = new AppModel();
new AppView({ model: appModel }).render().showOpenFile(appModel.settings.get('lastOpenFile'));
}
});

View File

@ -20,11 +20,12 @@
@include th {
border: 1px solid action-color();
background-color: action-color();
color: text-color();
color: text-contrast-color(action-color());
&.btn-error, &.btn-silent {
border-color: base-border-color();
background-color: transparent;
color: text-contrast-color(background-color());
}
&:hover {
@ -38,7 +39,6 @@
border-color: action-background-color-focus();
background-color: rgba(action-background-color-focus(), .1);
}
color: text-color();
}
&:active {

View File

@ -20,6 +20,7 @@ $violet: #d946db;
@function muted-color-border() { @return mix(medium-color(), background-color(), 15%); }
@function text-selection-bg-color() { @return rgba(action-color(), .3); }
@function text-selection-bg-color-error() { @return rgba(error-color(), .8); }
@function text-contrast-color($bg) { @if (lightness($bg) >= lightness(background-color())) { @return text-color(); } @else { @return background-color(); } }
// Borders, shadows