From 71b478fe9891c9a31dfa889ee842466d4b6fb343 Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 15 Mar 2018 19:56:05 +0300 Subject: [PATCH] use CM theme for applies-to buttons --- edit/applies-to-line-widget.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/edit/applies-to-line-widget.js b/edit/applies-to-line-widget.js index b0d0dce8..4bf75d15 100644 --- a/edit/applies-to-line-widget.js +++ b/edit/applies-to-line-widget.js @@ -214,6 +214,11 @@ function createAppliesToLineWidget(cm) { } function updateWidgetStyle() { + if (prefs.get('editor.theme') !== 'default' && + !tryCatch(() => $('#cm-theme').sheet.cssRules)) { + requestAnimationFrame(updateWidgetStyle); + return; + } const MIN_LUMA = .05; const MIN_LUMA_DIFF = .4; const color = { @@ -249,8 +254,9 @@ function createAppliesToLineWidget(cm) { color: ${fore}; } .applies-to input, + .applies-to button, .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) }); border: ${borderStyleForced}; @@ -261,9 +267,6 @@ function createAppliesToLineWidget(cm) { fill: ${fore}; transition: none; } - .applies-to button { - color: ${fore}; - } `; document.documentElement.appendChild(actualStyle); }