[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/face-shift 80ed3c9ee2 17/50: added missing cl-lib depen
From: |
ELPA Syncer |
Subject: |
[elpa] externals/face-shift 80ed3c9ee2 17/50: added missing cl-lib dependency |
Date: |
Sun, 30 Apr 2023 12:03:19 -0400 (EDT) |
branch: externals/face-shift
commit 80ed3c9ee2a2aa16ed455c83d6fda21645bf4c1c
Author: Philip K <philip@warpmail.net>
Commit: Philip K <philip@warpmail.net>
added missing cl-lib dependency
---
face-shift.el | 51 ++++++++++++++++++++++++++-------------------------
1 file changed, 26 insertions(+), 25 deletions(-)
diff --git a/face-shift.el b/face-shift.el
index fbb7bbe44d..7b73147627 100644
--- a/face-shift.el
+++ b/face-shift.el
@@ -3,7 +3,7 @@
;; Author: Philip K. <philip@warpmail.net>
;; Version: 0.1.0
;; Keywords: faces
-;; Package-Requires: ((emacs "24.1"))
+;; Package-Requires: ((emacs "24.1") (cl-lib "0.5"))
;; URL: https://git.sr.ht/~zge/face-shift
;; This file is NOT part of Emacs.
@@ -16,8 +16,8 @@
;;; Commentary:
;;
-;; `face-shift-by' generates a function that linearly shifts all faces
-;; in `face-shift-faces'.
+;; `face-shift--shift' generates a function that shifts all faces in
+;; `face-shift-faces'.
;;
;; To use face shift, add a function generated by `face-shift' to a hook
;; of your choice like so:
@@ -44,19 +44,19 @@ Note that it might be necessary to change the value of
`face-shift-intensity' to get the intended effect."
:type 'boolean)
-(defcustom face-shift-intensity 0.25
+(defcustom face-shift-intensity 0.75
"Value to replace a `int' symbol with in `face-shift-color'."
:type 'float)
(defcustom face-shift-color
- '((red . 0)
- (cyan . 180)
- (blue . 240)
- (pink . 300)
- (yellow . 60)
- (peach . 40)
- (green . 120)
- (purple . 280))
+ `((red . ,(* 2 pi (/ 0 360.0)))
+ (cyan . ,(* 2 pi (/ 180 360.0)))
+ (blue . ,(* 2 pi (/ 240 360.0)))
+ (pink . ,(* 2 pi (/ 300 360.0)))
+ (yellow . ,(* 2 pi (/ 60 360.0)))
+ (peach . ,(* 2 pi (/ 40 360.0)))
+ (green . ,(* 2 pi (/ 120 360.0)))
+ (purple . ,(* 2 pi (/ 280 360.0))))
"Alist of matrices representing RGB transformations.
Symbols `int', `max' and `min' are substituted with
`face-shift-intensity', `face-shift-maximum' and
@@ -75,30 +75,31 @@ Symbols `int', `max' and `min' are substituted with
:type '(list face)
:group 'face-shift)
-(defun face-shift-by (face prop hue)
+(defun face-shift--shift (face prop hue)
"Calculate color distortion and apply to property PROP of FACE.
MAT describes the linear transformation that calculates the new
color. If property PROP is not a color, nothing is changed."
(let* ((intensity (if face-shift-inverted
- (- 1 face-shift-intensity)
+ (- 1 face-shift-intensity)
face-shift-intensity))
(bg (face-attribute face prop)))
(unless (eq bg 'unspecified)
- (let* ((color-rgb (color-name-to-rgb bg))
- (color-hsl (apply #'color-rgb-to-hsl color-rgb))
- (new-rgb (apply #'color-hsl-to-rgb
- (list (/ hue 360.0)
-
face-shift-intensity
- (nth 2
color-hsl))))
- (ncolor (apply #'color-rgb-to-hex new-rgb)))
- (face-remap-add-relative face `(,prop ,ncolor))))))
+ (let* ((rgb (color-name-to-rgb bg))
+ (hsl (apply #'color-rgb-to-hsl rgb))
+ (hsl* (list (sqrt (* hue (nth 0 hsl)))
+ intensity
+ (nth 2 hsl)))
+ (rgb* (apply #'color-hsl-to-rgb hsl*))
+ (shift (apply #'color-rgb-to-hex rgb*)))
+ (message "shift %s/%s %d to %s" face prop hue shift)
+ (face-remap-add-relative face `(,prop ,shift))))))
(defun face-shift (color &optional ignore)
"Produce a function that will shift face color.
All background and foreground color behind the faces listed in
`face-shift-faces' will be attempted to shift using
-`face-shift-by'. The generated function can then be added to a
+`face-shift--shift'. The generated function can then be added to a
hook. COLOR should index a transformation from the
`face-shift-color' alist.
@@ -113,8 +114,8 @@ added to is ‘mail-mode’ or a derivative."
(lambda ()
(unless (cl-some #'derived-mode-p ignore)
(dolist (face face-shift-faces)
- (face-shift-by face :foreground hue)
- (face-shift-by face :background hue))))))
+ (face-shift--shift face :foreground hue)
+ (face-shift--shift face :background hue))))))
(provide 'face-shift)
- [elpa] branch externals/face-shift created (now b9f09af534), ELPA Syncer, 2023/04/30
- [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 <=
- [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, 2023/04/30
- [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