emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master e2d9843 01/11: [#26] Fix when default background is unspec


From: Artur Malabarba
Subject: [elpa] master e2d9843 01/11: [#26] Fix when default background is unspecified-fg or unspecified-bg
Date: Fri, 30 Oct 2015 09:54:01 +0000

branch: master
commit e2d9843a066593d379bf84da9bd2b0491c31a0f5
Author: Syohei YOSHIDA <address@hidden>
Commit: Artur Malabarba <address@hidden>

    [#26] Fix when default background is unspecified-fg or unspecified-bg
    
    Default background color is unspecified-fg or unspecified-bg if emacs runs 
in
    no-window mode(emacs -nw). '(color-values "unspecified-[fb]g")' returns nil
    and beacon--color-range raises error.
    
    Applying this patch uses fallback color instead of default background color.
    
    Copyright-paperwork-exempt: yes
---
 beacon.el |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/beacon.el b/beacon.el
index 6433ba0..eb08d1a 100644
--- a/beacon.el
+++ b/beacon.el
@@ -44,6 +44,13 @@
   :group 'emacs
   :prefix "beacon-")
 
+(defface beacon-fallback
+  '((((class color) (background light))
+     (:background "black"))
+    (((class color) (background dark))
+     (:background "white")))
+  "Fallback background color")
+
 (defvar beacon--timer nil)
 
 (defcustom beacon-push-mark 35
@@ -221,7 +228,10 @@ Only returns `beacon-size' elements."
 
 (defun beacon--color-range ()
   "Return a list of background colors for the beacon."
-  (let* ((bg (color-values (face-attribute 'default :background)))
+  (let* ((default-bg (face-attribute 'default :background))
+         (bg (color-values (if (string-prefix-p "unspecified" default-bg)
+                               (face-attribute 'beacon-fallback :background)
+                             default-bg)))
          (fg (cond
               ((stringp beacon-color) (color-values beacon-color))
               ((< (color-distance "black" bg)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]