From b07c405a18a84cef02fd3286fd6e4cd7d9bc76e2 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 2 May 2017 01:10:52 -0400 Subject: [PATCH] doom-blend: fail gracefully --- doom-themes.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doom-themes.el b/doom-themes.el index 52a0b93..a23ff99 100644 --- a/doom-themes.el +++ b/doom-themes.el @@ -126,10 +126,11 @@ for FRAME (defaults to the current frame)." (defun doom-blend (color1 color2 alpha) "Blend two colors (hexidecimal strings) together by a coefficient ALPHA (a float between 0 and 1)" - (apply (lambda (r g b) (format "#%02x%02x%02x" (* r 255) (* g 255) (* b 255))) - (cl-mapcar (lambda (it other) (+ (* alpha it) (* other (- 1 alpha)))) - (doom-name-to-rgb color1) - (doom-name-to-rgb color2)))) + (when (and color1 color2) + (apply (lambda (r g b) (format "#%02x%02x%02x" (* r 255) (* g 255) (* b 255))) + (cl-mapcar (lambda (it other) (+ (* alpha it) (* other (- 1 alpha)))) + (doom-name-to-rgb color1) + (doom-name-to-rgb color2))))) (defun doom-darken (color alpha) "Darken a COLOR (a hexidecimal string) by a coefficient ALPHA (a float between