From c8fee154227976268b811160c7b5dc868e8f3ada Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Sun, 7 Apr 2024 14:12:37 +0100 Subject: [PATCH] Change the default theme from dracula to base16 based theme --- lisp/fg42/deps.el | 1 + lisp/fg42/modeline.el | 16 ++++++++++++++-- lisp/fg42/themes.el | 38 ++++++++++++++++++++++---------------- lisp/fg42/utils.el | 10 ++++++++++ 4 files changed, 47 insertions(+), 18 deletions(-) diff --git a/lisp/fg42/deps.el b/lisp/fg42/deps.el index 65228bd..0bc5647 100644 --- a/lisp/fg42/deps.el +++ b/lisp/fg42/deps.el @@ -121,6 +121,7 @@ nerd-icons forge svg-tag-mode + base16-theme consult) (provide 'fg42/deps) diff --git a/lisp/fg42/modeline.el b/lisp/fg42/modeline.el index 529aceb..5851869 100644 --- a/lisp/fg42/modeline.el +++ b/lisp/fg42/modeline.el @@ -24,11 +24,18 @@ (eval-when-compile (require 'fpkg)) +(require 'fg42/utils) (defvar fg42/modeline-views nil "A list of Noether views to use for modeline.") +(defvar fg42/modeline-active-face nil + "Override the active modeline face via this var.") + +(defvar fg42/modeline-inactive-face nil + "Override the inactive modeline face via this var.") + (defface fg42/-disabled-modeline-active-border '((t :background "#bd93f9" :height 0.1 :box nil)) @@ -53,13 +60,18 @@ to Emacs modeline." :config (require 'noether-views) + (let ((active-border (get-base16-color-or :base0A "#bd93f9")) + (inactive-border (get-base16-color-or :base04 "#44475a"))) + (set-face-attribute 'fg42/-disabled-modeline-active-border nil :background active-border) + (set-face-attribute 'fg42/-disabled-modeline-dective-border nil :background inactive-border)) + ;; Disable the default modeline (setq-default mode-line-format "") (let ((face-remaps (default-value 'face-remapping-alist))) (setf (alist-get 'mode-line face-remaps) - 'fg42/-disabled-modeline-active-border + (if fg42/modeline-active-face fg42/modeline-active-face 'fg42/-disabled-modeline-active-border) (alist-get 'mode-line-inactive face-remaps) - 'fg42/-disabled-modeline-dective-border + (if fg42/modeline-inactive-face fg42/modeline-inactive-face 'fg42/-disabled-modeline-dective-border) (default-value 'face-remapping-alist) face-remaps)) (setq-default noether-views (or fg42/modeline-views diff --git a/lisp/fg42/themes.el b/lisp/fg42/themes.el index d1ee956..36e0ff9 100644 --- a/lisp/fg42/themes.el +++ b/lisp/fg42/themes.el @@ -61,22 +61,22 @@ It executes way before the rest of the cubes.") ,@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! 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 @@ -88,5 +88,11 @@ It executes way before the rest of the cubes.") (enable-theme 'badwolf))) +(use! base16-theme + "Load base16 based themes in FG42." + :config + (load-theme 'base16-eighties t)) + + (provide 'fg42/themes) ;;; themes.el ends here diff --git a/lisp/fg42/utils.el b/lisp/fg42/utils.el index f8f9025..3aee1c0 100644 --- a/lisp/fg42/utils.el +++ b/lisp/fg42/utils.el @@ -196,5 +196,15 @@ is non-nil value it means that the function can be called interactively." (fg42/log "INFO" args)) +(defun get-base16-color-or (color-name default) + "Return the color for COLOR-NAME if a base16 theme is loade otherwise DEFAULT." + (let* ((theme (car custom-enabled-themes)) + (theme-sym (intern (format "%s-theme-colors" theme)))) + + (if (boundp theme-sym) + (or (eval `(plist-get ,theme-sym ,color-name)) default) + default))) + + (provide 'fg42/utils) ;;; utils.el ends here