[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 36be965 09/34: Make beacon color customizable
From: |
Artur Malabarba |
Subject: |
[elpa] master 36be965 09/34: Make beacon color customizable |
Date: |
Fri, 16 Oct 2015 09:56:51 +0000 |
branch: master
commit 36be965f54c250cc6e20532babfc467c014ae5d0
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
Make beacon color customizable
---
beacon.el | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/beacon.el b/beacon.el
index f081934..18d4819 100644
--- a/beacon.el
+++ b/beacon.el
@@ -71,9 +71,17 @@ movement distance (in lines) that triggers a beacon blink."
"Size of the beacon in characters."
:type 'number)
-(defcustom beacon-brightness 0.4
- "Brightness as a float between 0 and 1."
- :type 'number)
+(defcustom beacon-color 0.5
+ "Color of the beacon.
+This can be a string or a number.
+
+If it is a number, the color is taken to be white or
+black (depending on the current theme's background) and this
+number is a float between 0 and 1 specifing the brightness.
+
+If it is a string, it is a color name or specification,
+e.g. \"#666600\"."
+ :type '(choice number color))
;;; Overlays
@@ -110,12 +118,16 @@ 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))))
- (apply #'cl-mapcar (lambda (r g b) (format "#%04x%04x%04x" r g b))
- (if (< (color-distance "black" bg)
+ (let* ((bg (color-values (face-attribute 'default :background)))
+ (fg (cond
+ ((stringp beacon-color) (color-values beacon-color))
+ ((< (color-distance "black" bg)
(color-distance "white" bg))
- (mapcar (lambda (n) (butlast (beacon--int-range (*
beacon-brightness 65535) n))) bg)
- (mapcar (lambda (n) (cdr (beacon--int-range (* (- 1
beacon-brightness) 65535) n))) bg)))))
+ (make-list 3 (* beacon-color 65535)))
+ (t (make-list 3 (* (- 1 beacon-color) 65535))))))
+ (apply #'cl-mapcar (lambda (r g b) (format "#%04x%04x%04x" r g b))
+ (mapcar (lambda (n) (butlast (beacon--int-range (elt fg n) (elt bg
n))))
+ [0 1 2]))))
;;; Blinking
- [elpa] master updated (6578236 -> 2eb4c54), Artur Malabarba, 2015/10/16
- [elpa] master b509d63 04/34: [Fix #1], Artur Malabarba, 2015/10/16
- [elpa] master 3022997 02/34: Rename to beacon, Artur Malabarba, 2015/10/16
- [elpa] master 36be965 09/34: Make beacon color customizable,
Artur Malabarba <=
- [elpa] master 43cbfd4 15/34: Merge pull request #3 from tsdh/master, Artur Malabarba, 2015/10/16
- [elpa] master 8abbedc 05/34: Default to blinking on window scroll instead of point movement, Artur Malabarba, 2015/10/16
- [elpa] master fbcf9fc 16/34: Drop cl-lib dep, Artur Malabarba, 2015/10/16
- [elpa] master 19096a6 10/34: Initial (failed) impl for beacon at end of line, Artur Malabarba, 2015/10/16
- [elpa] master e533e04 11/34: Fix an error, Artur Malabarba, 2015/10/16
- [elpa] master 03d12b4 03/34: Rename file, Artur Malabarba, 2015/10/16
- [elpa] master 8941740 07/34: Fix docs, Artur Malabarba, 2015/10/16
- [elpa] master c82095a 06/34: Add url, Artur Malabarba, 2015/10/16
- [elpa] master 9152a09 08/34: Separate mark-pushing from blinking, Artur Malabarba, 2015/10/16
- [elpa] master b60416c 01/34: First commit, Artur Malabarba, 2015/10/16