Fixup usercss applies-to theme detection

This commit is contained in:
narcolepticinsomniac 2018-10-18 23:05:47 -04:00 committed by GitHub
parent 686c099dbc
commit 63a6098c2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 49 deletions

View File

@ -222,6 +222,7 @@ function createAppliesToLineWidget(cm) {
requestAnimationFrame(updateWidgetStyle);
return;
}
if (prefs.get('editor.theme') !== 'default') {
const MIN_LUMA = .05;
const MIN_LUMA_DIFF = .4;
const color = {
@ -257,9 +258,8 @@ function createAppliesToLineWidget(cm) {
color: ${fore};
}
.applies-to input,
.applies-to button,
.applies-to select {
background: rgba(255, 255, 255, ${
background-color: rgba(255, 255, 255, ${
Math.max(MIN_LUMA, Math.pow(Math.max(0, color.gutter.bgLuma - MIN_LUMA * 2), 2)).toFixed(2)
});
border: ${borderStyleForced};
@ -267,11 +267,16 @@ function createAppliesToLineWidget(cm) {
color: ${fore};
}
.applies-to .svg-icon.select-arrow {
fill: ${fore};
transition: none;
fill: ${fore} !important;
}
.applies-to select option {
background-color: ${color.gutter.bg};
}
`;
document.documentElement.appendChild(actualStyle);
} else if (prefs.get('editor.theme') === 'default') {
actualStyle.textContent = '';
}
}
function doUpdate() {
@ -283,7 +288,7 @@ function createAppliesToLineWidget(cm) {
if (i === -2) {
i = widgets.length - 1;
}
if (j < 0) {
if (j < 0) {actualStyle
j = widgets.length;
}

View File

@ -806,6 +806,9 @@ html:not(.usercss) .usercss-only,
margin: 1em 0;
padding: .75rem .75rem .25rem;
padding-right: calc(1em + 20px);
}
.CodeMirror.cm-s-default .CodeMirror-linewidget .applies-to {
background-color: var(--gray-lightness-90);
border-top: 1px solid var(--truegray-alpha-3);
border-bottom: 1px solid var(--truegray-alpha-3);