mirror of
https://github.com/protesilaos/modus-themes.git
synced 2026-09-10 07:16:30 -04:00
Define helper to reduce a color from 4 digits per triplet to 2
This commit is contained in:
parent
ecfd90d430
commit
1129cf5f92
|
|
@ -7540,6 +7540,18 @@ For instance:
|
|||
(push (+ (* (nth i a) alpha) (* (nth i b) (- 1 alpha))) blend))
|
||||
(nreverse blend)))
|
||||
|
||||
(defun modus-themes--color-six-digits (color)
|
||||
"Reduce representation of hexadecimal RGB COLOR to six digits."
|
||||
(let ((color-no-hash (substring color 1)))
|
||||
(if (= (length color-no-hash) 6)
|
||||
color
|
||||
(let* ((triplets (seq-split color-no-hash 4))
|
||||
(triplets-shortened (mapcar
|
||||
(lambda (string)
|
||||
(substring string 0 2))
|
||||
triplets)))
|
||||
(concat "#" (string-join triplets-shortened))))))
|
||||
|
||||
(defun modus-themes-generate-color-blend (color blended-with alpha)
|
||||
"Return hexademical RGB of COLOR with BLENDED-WITH given ALPHA.
|
||||
BLENDED-WITH is commensurate with COLOR. ALPHA is between 0.0 and 1.0,
|
||||
|
|
|
|||
Loading…
Reference in a new issue