[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/focus eeb12d8db8 19/82: Added function to generate color b
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/focus eeb12d8db8 19/82: Added function to generate color based on `focus-dimness' |
Date: |
Tue, 6 Sep 2022 04:58:55 -0400 (EDT) |
branch: elpa/focus
commit eeb12d8db89064cc07092b289a8c8436eabdf449
Author: Lars Tveito <larstvei@ifi.uio.no>
Commit: Lars Tveito <larstvei@ifi.uio.no>
Added function to generate color based on `focus-dimness'
---
focus.el | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/focus.el b/focus.el
index f8bbe8378f..e20356f4af 100644
--- a/focus.el
+++ b/focus.el
@@ -69,6 +69,17 @@ of RGB values of the given colors."
(avg (mapcar (lambda (v) (/ v len)) sums)))
(apply 'color-rgb-to-hex avg)))
+(defun focus-make-dim-color ()
+ "Uses `focus-dimness' to determine how dim a color that should
+be generated, and returns this color."
+ (let ((background (face-attribute 'default :background))
+ (foreground (face-attribute 'default :foreground))
+ (backgrounds (if (> focus-dimness 0) focus-dimness 1))
+ (foregrounds (if (< focus-dimness 0) (- focus-dimness) 1)))
+ (apply 'focus-average-colors
+ (append (make-list backgrounds background)
+ (make-list foregrounds foreground)))))
+
(defun focus-move-focus ()
"If `focus-mode' is enabled, this command fires after each
command, and moves the dimming overlays."
@@ -84,9 +95,7 @@ are invisible until `focus-move-focus' is run. It adds
focus-move-focus to `post-command-hook'."
(setq focus-pre-overlay (make-overlay (point-min) (point-min))
focus-post-overlay (make-overlay (point-max) (point-max)))
- (let ((color (focus-average-colors
- (face-attribute 'default :foreground)
- (face-attribute 'default :background))))
+ (let ((color (focus-make-dim-color)))
(mapc (lambda (o) (overlay-put o 'face (cons 'foreground-color color)))
(list focus-pre-overlay focus-post-overlay)))
(add-hook 'post-command-hook 'focus-move-focus nil t))
- [nongnu] elpa/focus 03e3cbc566 05/82: Documented every function/variable, (continued)
- [nongnu] elpa/focus 03e3cbc566 05/82: Documented every function/variable, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 497d13d758 32/82: Added functions for jumping between things, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 307df45c69 51/82: Fix #5, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 3013760ef0 12/82: Resizing did not work, retry!, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus ff93c948da 26/82: Added defgroup, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 6a6da19b00 09/82: Fixed image names, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 741a945866 55/82: Merge branch 'syohex-cl-lib', ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus b4fb132314 23/82: Changing modes should not affect Focus mode, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 809697ba52 25/82: Changed paragraph to sections, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 27eda82b95 40/82: Binding for enabling focus-read-only-mode in focus-mode, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus eeb12d8db8 19/82: Added function to generate color based on `focus-dimness',
ELPA Syncer <=
- [nongnu] elpa/focus 500bab4833 13/82: Yet another try, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 3fafdc7947 62/82: Allow explicitly setting derived modes in focus-mode-to-thing, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 9a5cf4f972 77/82: Formatting, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 663205443c 21/82: Forgot to rename variables everywhere, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 4d31363bf9 54/82: Use cl-lib function instead of cl.el, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus af9fbfd9cb 06/82: Changed name and added header, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 02cec3494d 01/82: Initial commit, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus e691113e4b 03/82: Moved init/termination to separate functions, ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 284a1240ce 33/82: Cleaned up doc in `focus-average-colors', ELPA Syncer, 2022/09/06
- [nongnu] elpa/focus 58a91b29aa 34/82: Split focus-bounds into two functions, ELPA Syncer, 2022/09/06