[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/face-shift 0a7cf055ac 23/50: implemented intensity vari
From: |
ELPA Syncer |
Subject: |
[elpa] externals/face-shift 0a7cf055ac 23/50: implemented intensity variable |
Date: |
Sun, 30 Apr 2023 12:03:20 -0400 (EDT) |
branch: externals/face-shift
commit 0a7cf055ac2de33c376c0f9aa20ac0d2ec785436
Author: Philip K <philip@warpmail.net>
Commit: Philip K <philip@warpmail.net>
implemented intensity variable
---
face-shift.el | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/face-shift.el b/face-shift.el
index dfd797170f..42bb527448 100644
--- a/face-shift.el
+++ b/face-shift.el
@@ -84,6 +84,26 @@ information."
(defvar-local face-shift--cookies nil
"List of remapped faces in a single buffer.")
+(defcustom face-shift-intensity 0.9
+ "Relaxation factor when applying a colour-shift.
+
+Positive values between [0;1] will lighten up the resulting shift
+more (where 0 is the lightest), while values between [-1;0] will
+darken it (where 0 is the darkest).
+
+Values beyond [-1;1] are not supported.
+
+See `face-shift--interpolate'."
+ :type 'float)
+
+(defun face-shift--interpolate (col-ref col-base)
+ "Attempt to find median colour between `col-ref' and `col-base'."
+ (map 'list (lambda (ref base)
+ (if (> face-shift-intensity 0)
+ (- 1 (* (- 1 (* ref base)) face-shift-intensity))
+ (* (* ref base) (abs face-shift-intensity))))
+ col-ref col-base))
+
(defun face-shift-setup (&optional buffer)
"Shift colours in BUFFER according to `face-shift-shifts'.
@@ -96,7 +116,7 @@ If BUFFER is nil, use current buffer."
(dolist (prop '(:foreground :background))
(let* ((attr (face-attribute face prop))
(rgb (and attr (color-name-to-rgb attr)))
- (shift (and rgb (cl-map 'list #'* col-rgb rgb)))
+ (shift (and rgb (face-shift--interpolate col-rgb rgb)))
(new (and shift (apply #'color-rgb-to-hex shift))))
(when new
(push (face-remap-add-relative face `(,prop ,new))
@@ -113,7 +133,8 @@ If BUFFER is nil, use current buffer."
(define-minor-mode face-shift-mode
"Shift fore- and background colour towards a certain hue.
-See `face-shift-shifts' for more information"
+See `face-shift-shifts' and `face-shift-intensity' for more
+information"
:group 'face-shift
:global t
(if face-shift-mode
- [elpa] externals/face-shift 3ab11c7b89 05/50: force-fit transformations by dividing with max-norm, (continued)
- [elpa] externals/face-shift 3ab11c7b89 05/50: force-fit transformations by dividing with max-norm, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 931fd63a10 06/50: removed unnecesaary :group keys from defcustoms, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 0a42010131 01/50: initial export, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 547ec4e6b2 04/50: fixed packaging issues, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 3623c6093b 03/50: added cc0 as licence, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 90c3a35e18 09/50: added initial readme, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift c09d67f54e 10/50: added missing docstring, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 4e37f6ecd1 12/50: re-spelt all instances of "colour" to "color", ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 80ed3c9ee2 17/50: added missing cl-lib dependency, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 2ddb8a90d2 21/50: removed dependency on when-let*, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 0a7cf055ac 23/50: implemented intensity variable,
ELPA Syncer <=
- [elpa] externals/face-shift 0170ab2993 30/50: Update URL header, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 30cf63243b 08/50: fixed some metadata values, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 20469831a8 11/50: fixed package-lint issues, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 0fdf8c59b1 13/50: made face-shift-color type more concrete, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 327a06daa7 15/50: replaced rx with literal macro, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 194b4dc2d0 07/50: added initial support for dark backgrounds, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 95efc40b7b 02/50: converted all tabs to spaces, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 601cee00a6 14/50: converted all tabs to regular whitespaces, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift f7922b4216 26/50: fix missing link to the public-inbox, ELPA Syncer, 2023/04/30
- [elpa] externals/face-shift 726c0f198f 27/50: switched from map to cl-map to avoid implicit cl dependency, ELPA Syncer, 2023/04/30