diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2019-05-28 10:13:43 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2019-05-28 10:13:43 +0200 |
| commit | 4def9b711509c48665d7390cccfd324423b4b3ec (patch) | |
| tree | c7ed477250a42b2dc0d781c5b88f47890d6fe6f8 /helpers.el | |
| parent | 750899cdcd305ef33da2d5838eedb972c077be4d (diff) | |
| download | eighters-theme-4def9b711509c48665d7390cccfd324423b4b3ec.tar.xz | |
Tweak diff faces again
Now with an actual formula to compute blends 🙌
Will probably tweak refined faces again to tone the color down.
Diffstat (limited to 'helpers.el')
| -rw-r--r-- | helpers.el | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/helpers.el b/helpers.el new file mode 100644 index 0000000..4cd07c7 --- /dev/null +++ b/helpers.el @@ -0,0 +1,41 @@ +(defun my/color-mix (color-1 color-2 ratio) + (let* ((c1 (color-name-to-rgb color-1)) + (c2 (color-name-to-rgb color-2)) + (mix (-zip-with + (lambda (i1 i2) (+ (* ratio i1) + (* (- 1 ratio) i2))) + c1 c2))) + (apply 'color-rgb-to-hex `(,@mix 2)))) + +;; Alternate implementation without -zip-with from dash. +(defun my/color-mix (color-1 color-2 ratio) + (let* ((c1 (color-name-to-rgb color-1)) + (c2 (color-name-to-rgb color-2)) + (mix (seq-map + (lambda (pair) (+ (* ratio (car pair)) + (* (- 1 ratio) (cdr pair)))) + (cl-pairlis c1 c2)))) + (apply 'color-rgb-to-hex `(,@mix 2)))) + +;; Diff faces. + +(list-colors-display + (seq-map (lambda (r) (my/color-mix "gray20" "steelblue2" r)) + (number-sequence 0.0 1.0 0.01)) + "*steelblues*") + +(list-colors-display + (seq-map (lambda (r) (my/color-mix "gray20" "orange2" r)) + (number-sequence 0.0 1.0 0.01)) + "*oranges*") + +;; background: +(my/color-mix "gray20" "orange2" 0.9) +(my/color-mix "gray20" "steelblue2" 0.9) +(my/color-mix "gray20" "gold2" 0.9) +(my/color-mix "gray20" "maroon2" 0.9) +;; refined: +(my/color-mix "gray20" "orange2" 0.6) +(my/color-mix "gray20" "steelblue2" 0.6) +(my/color-mix "gray20" "gold2" 0.6) +(my/color-mix "gray20" "maroon2" 0.6) |
