Create a macro similar to use! but specialized for themes

This commit is contained in:
Sameer Rahmani 2024-03-21 20:21:23 +00:00
parent 46f8869e1a
commit e3f744ae8f
Signed by: lxsameer
GPG Key ID: 8741FACBF412FFA5
2 changed files with 44 additions and 0 deletions

View File

@ -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)

View File

@ -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