From e3f744ae8f0fe5aa82d20bf0ba5b0469b71b462a Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Thu, 21 Mar 2024 20:21:23 +0000 Subject: [PATCH] Create a macro similar to use! but specialized for themes --- lisp/fg42.el | 2 ++ lisp/fg42/themes.el | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/lisp/fg42.el b/lisp/fg42.el index 1373a93..bfe54a3 100644 --- a/lisp/fg42.el +++ b/lisp/fg42.el @@ -73,6 +73,8 @@ (when (file-exists-p user-init-file) (load user-init-file)) + (fg42/setup-editor) + (add-hook 'emacs-startup-hook (lambda () (run-hooks 'fg42/after-init-hook) diff --git a/lisp/fg42/themes.el b/lisp/fg42/themes.el index b8d7e0f..7999c11 100644 --- a/lisp/fg42/themes.el +++ b/lisp/fg42/themes.el @@ -25,6 +25,8 @@ ;; way. Cubes are composable and a composition of cubes creates an editor. ;; ;;; Code: +(eval-when-compile + (require 'fpkg)) (require 'fg42/utils) (defvar fg42/ui-hook () @@ -46,5 +48,45 @@ It executes way before the rest of the cubes.") ,@body)) +(defmacro use-theme! (name &rest body) + "Create a function to setup a them with the given NAME and BODY to customize it." + (declare (indent defun)) + (let ((fn-name (intern (format "fg42/setup-%s" (symbol-name name))))) + `(defun ,fn-name () + (use! ,name + "Setting up the ,name package." + :init + (fg42/setup-theme + (require ',name) + ,@body))))) + + +(use-theme! dracula-theme + :init + (fg42/setup-theme + (require 'dracula-theme) + (load-theme 'dracula t) + (custom-theme-set-faces + 'dracula + '(match ((t (:background "#44475a")))) + '(all-the-icons-lgreen ((t (:background "#bd93f9")))) + '(all-the-icons-faicon ((t (:background "#bd93f9")))) + '(font-lock-comment-face ((t (:foreground "#8B9298")))) + ;; This fixes lsp-ui-sideline issue + '(lsp-ui-sideline-current-symbol ((t (:line-width -1 :foreground "#bd93f9")))) + '(font-lock-comment-delimiter-face ((t (:foreground "#5B6268"))))) + (enable-theme 'dracula) + (set-face-attribute 'region nil :background "#888"))) + + +(use-theme! badwolf-theme + :init + (fg42/setup-theme + (load-theme 'badwolf t) + (custom-theme-set-faces + 'badwolf) + (enable-theme 'badwolf))) + + (provide 'fg42/themes) ;;; themes.el ends here