Programatic color palette blending
Just thought I would share a little snippet I put together for my Emacs configuration (obviously based on code that's already in the manual). It blends a theme's palette with a given pair of colors, one for the background colors and one for the foreground colors. The colors I chose here give modus-themes a yellowish, Gruvbox-esque tint.
(setq modus-operandi-bg-blend "#fbf1c7"
modus-operandi-fg-blend "#3a4042"
modus-vivendi-bg-blend "#3a4042"
modus-vivendi-fg-blend "#d7b765")
(defun modus-themes-tint-palette (palette bg-blend fg-blend)
"Modify Modus PALETTE programmatically and return a new palette.
Blend background colors with BG-BLEND and foreground colors with FG-BLEND."
(require 'kurecolor)
(let (name cons colors)
(dolist (cons palette)
(let ((blend (if (string-match "bg" (symbol-name (car cons)))
bg-blend
fg-blend)))
(setq name (kurecolor-interpolate (cdr cons) blend)))
(setq name (format "%s" name))
(setq cons `(,(car cons) . ,name))
(push cons colors))
colors))
(define-minor-mode modus-themes-tinted-mode
"Tweak some Modus themes colors."
:init-value nil
:global t
(if modus-themes-tinted-mode
(setq modus-themes-operandi-color-overrides
(modus-themes-tint-palette modus-themes-operandi-colors
modus-operandi-bg-blend
modus-operandi-fg-blend)
modus-themes-vivendi-color-overrides
(modus-themes-tint-palette modus-themes-vivendi-colors
modus-vivendi-bg-blend
modus-vivendi-fg-blend))
(setq modus-themes-operandi-color-overrides nil
modus-themes-vivendi-color-overrides nil)))
(modus-themes-tinted-mode 1)
(Instead of kurecolor-interpolate
, you can also use doom-blend
from doom-themes.)