Color Lighten and Darken

RGB color lighten and darken in catppuccin-themes.

(defun catppuccin-themes-blend (a b &optional alpha)
  "Blend the two colors A and B in linear space with ALPHA (a float between 0 and 1)."
  (pcase-let ((`(,r ,g ,b) (color-blend (color-name-to-rgb a) (color-name-to-rgb b) alpha)))
    (color-rgb-to-hex r g b 2)))

(defun catppuccin-themes-lighten (color value)
  "Lighten COLOR by VALUE% (0–100)."
  (let* ((alpha (/ value 100.0)))
    (catppuccin-themes-blend color "#ffffff" (- 1 alpha))))

(defun catppuccin-themes-darken (color value)
  "Darken COLOR by VALUE% (0–100)."
  (let* ((alpha (/ value 100.0)))
    (catppuccin-themes-blend color "#000000" (- 1 alpha))))

(catppuccin-themes-darken "#eff1f5" 5)
(catppuccin-themes-lighten "#303446" 5)

Related

DIY Modus Themes

Each Modus theme specifies a color palette that declares named color values and semantic color mappings.

Emacs tokyonight-themes

A clean dark Visual Studio Code theme that celebrates the lights of Downtown Tokyo at night.

Emacs Garbage Collection

gcmh(aka “Garbage Collection Magic Hack”) is useful and easy to handle garbage collection for GNU Emacs.