From fb1bf9e53d71347c9c77ecf696e0ade1928b8c99 Mon Sep 17 00:00:00 2001 From: Jeremy Baxter Date: Sat, 28 Sep 2024 18:33:14 +1200 Subject: [PATCH] feat: add function catppuccin-insert-color --- catppuccin-theme.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/catppuccin-theme.el b/catppuccin-theme.el index 7c3e877..552baba 100644 --- a/catppuccin-theme.el +++ b/catppuccin-theme.el @@ -43,6 +43,8 @@ ;;; Code: +(eval-when-compile (require 'subr-x)) + (deftheme catppuccin) ;;; Configuration options: @@ -239,6 +241,15 @@ FLAVOR defaults to the value of `catppuccin-flavor'." (defalias 'catppuccin-get-color 'catppuccin-color) +(defun catppuccin-insert-color (color &optional flavor) + "Insert COLOR at point." + (interactive "SColor: ") + (let ((color (catppuccin-color color flavor))) + (insert + (if (char-equal (char-before) ?#) + (string-remove-prefix "#" color) + color)))) + ;;; Theme definition: (let