X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/010e64bef8a9ec5539733ff0c2e92d075b25a271..e3ab5c3b4a3cf5c6e099534d6c1db5672511f67b:/beacon.el diff --git a/beacon.el b/beacon.el index 6433ba054..ffdbcbc3b 100644 --- a/beacon.el +++ b/beacon.el @@ -103,6 +103,13 @@ If it is a string, it is a color name or specification, e.g. \"#666600\"." :type '(choice number color)) +(defface beacon-fallback-background + '((((class color) (background light)) (:background "black")) + (((class color) (background dark)) (:background "white"))) + "Fallback beacon background color. +Used in cases where the color can't be determined by Emacs. +Only the background of this face is used.") + (defvar beacon-dont-blink-predicates nil "A list of predicates that prevent the beacon blink. These predicate functions are called in order, with no @@ -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-match "\\`unspecified-" default-bg) + (face-attribute 'beacon-fallback-background :background) + default-bg))) (fg (cond ((stringp beacon-color) (color-values beacon-color)) ((< (color-distance "black" bg)