use CM theme for applies-to buttons

This commit is contained in:
tophf 2018-03-15 19:56:05 +03:00
parent f2d49ecbb9
commit 71b478fe98

View File

@ -214,6 +214,11 @@ function createAppliesToLineWidget(cm) {
} }
function updateWidgetStyle() { function updateWidgetStyle() {
if (prefs.get('editor.theme') !== 'default' &&
!tryCatch(() => $('#cm-theme').sheet.cssRules)) {
requestAnimationFrame(updateWidgetStyle);
return;
}
const MIN_LUMA = .05; const MIN_LUMA = .05;
const MIN_LUMA_DIFF = .4; const MIN_LUMA_DIFF = .4;
const color = { const color = {
@ -249,8 +254,9 @@ function createAppliesToLineWidget(cm) {
color: ${fore}; color: ${fore};
} }
.applies-to input, .applies-to input,
.applies-to button,
.applies-to select { .applies-to select {
background-color: rgba(255, 255, 255, ${ background: rgba(255, 255, 255, ${
Math.max(MIN_LUMA, Math.pow(Math.max(0, color.gutter.bgLuma - MIN_LUMA * 2), 2)).toFixed(2) Math.max(MIN_LUMA, Math.pow(Math.max(0, color.gutter.bgLuma - MIN_LUMA * 2), 2)).toFixed(2)
}); });
border: ${borderStyleForced}; border: ${borderStyleForced};
@ -261,9 +267,6 @@ function createAppliesToLineWidget(cm) {
fill: ${fore}; fill: ${fore};
transition: none; transition: none;
} }
.applies-to button {
color: ${fore};
}
`; `;
document.documentElement.appendChild(actualStyle); document.documentElement.appendChild(actualStyle);
} }