diff options
| -rw-r--r-- | bard-elisp/bard-theme.el | 101 | ||||
| -rw-r--r-- | bard-emacs-modules/bard-emacs-theme.el | 69 |
2 files changed, 104 insertions, 66 deletions
diff --git a/bard-elisp/bard-theme.el b/bard-elisp/bard-theme.el new file mode 100644 index 0000000..fb90c85 --- /dev/null +++ b/bard-elisp/bard-theme.el @@ -0,0 +1,101 @@ +(setq fontaine-presets + '((default + :default-height 160 + :default-family "Iosevka Comfy" + :variable-pitch-family "Iosevka Comfy Motion" + :variable-pitch-height 1.0 + :fixed-pitch-family "Iosevka Comfy" + :fixed-pitch-height 1.0 + :bold-weight bold + :mode-line-active-family "Iosevka Comfy Motion" + :mode-line-inactive-family "Iosevka Comfy Motion" + :mode-line-active-height 160 + :mode-line-inactive-height 160 + ) + (mixed + :inherit default + :variable-pitch-family "Iosevka Comfy Wide Motion Duo") + (wide + :inherit default + :default-height 150 + :default-family "Iosevka Comfy Wide" + :fixed-pitch-family "Iosevka Comfy Wide" + :mode-line-active-family "Iosevka Comfy Wide Motion Duo" + :mode-line-inactive-family "Iosevka Comfy Wide Motion Duo" + :variable-pitch-family "Iosevka Comfy Wide Motion Duo" + :mode-line-active-height 150 + :mode-line-inactive-height 150) + (large + :inherit default + :variable-pitch-family "Iosevka Comfy Wide Motion" + :default-height 170 + :mode-line-active-height 150 + :mode-line-inactive-height 150 + ) + (huge + :inherit default + :variable-pitch-family "Iosevka Comfy Wide Motion" + :default-height 200 + :mode-line-active-height 170 + :mode-line-inactive-height 170 + ) + (comic + :inherit default + :default-family "Comic Code" + :variable-pitch-family "Comic Code" + :fixed-pitch-family "Comic Code" + :mode-line-active-family "Comic Code" + :mode-line-inactive-family "Comic Code" + ) + (writing + :inherit default + :variable-pitch-family "Lora") + (bit + :inherit default + :default-height 180 + :mode-line-active-height 180 + :mode-line-inactive-height 180 + :default-family "Terminus" + :variable-pitch-family "Terminus" + :fixed-pitch-family "Terminus" + :mode-line-active-family "Terminus" + :mode-line-inactive-family "Terminus" + ) + (t + :default-family "Monospace" + ))) + +;; Switching themes +(defun bard/disable-all-themes () + "disable all active themes." + (interactive) + (dolist (i custom-enabled-themes) + (disable-theme i))) + +(defvar bard/after-theme-load-hook nil + "Hook that runs after a new theme is loaded using `bard/select-theme`.") + +(dolist (hook '(enable-theme-hook)) + (add-hook hook #'fontaine-apply-current-preset) + (add-hook hook #'logos-update-fringe-in-buffers)) + +(add-to-list 'enable-theme-functions #'logos-update-fringe-in-buffers) + +(add-to-list 'enable-theme-functions #'fontaine-apply-current-preset) + +(defun bard/select-theme () + "Prompt the user to select a theme from all available custom themes and enable it." + (interactive) + (let* ((theme (completing-read "Select theme: " (mapcar 'symbol-name (custom-available-themes)))) + (theme-symbol (intern theme)) + (theme-name (if (string-suffix-p "-theme" theme) + (substring theme 0 -6) + theme)) + (colored-theme-name (propertize theme-name 'face '(:weight bold)))) + (bard/disable-all-themes) + (load-theme theme-symbol t) + (message "Loaded the %s theme" colored-theme-name) + (run-hooks 'after-theme-load-hook))) + + +(provide 'bard-theme) diff --git a/bard-emacs-modules/bard-emacs-theme.el b/bard-emacs-modules/bard-emacs-theme.el index ef84a63..6984195 100644 --- a/bard-emacs-modules/bard-emacs-theme.el +++ b/bard-emacs-modules/bard-emacs-theme.el @@ -1,3 +1,5 @@ +(require 'bard-theme) + ;; declare all themes as safe (i trust developers) (setq custom-safe-themes t) @@ -134,66 +136,6 @@ The exact color values are taken from the active Modus theme." (use-package fontaine :ensure t :config - (setq fontaine-presets - '((default - :default-height 160 - :default-family "Iosevka Comfy" - :variable-pitch-family "Iosevka Comfy Motion" - :variable-pitch-height 1.0 - :fixed-pitch-family "Iosevka Comfy" - :fixed-pitch-height 1.0 - :bold-weight bold - :mode-line-active-family "Iosevka Comfy Motion" - :mode-line-inactive-family "Iosevka Comfy Motion" - :mode-line-active-height 160 - :mode-line-inactive-height 160 - ) - (wide - :inherit default - :default-height 150 - :default-family "Iosevka Comfy Wide" - :fixed-pitch-family "Iosevka Comfy Wide" - :mode-line-active-family "Iosevka Comfy Wide Motion Duo" - :mode-line-inactive-family "Iosevka Comfy Wide Motion Duo" - :variable-pitch-family "Iosevka Comfy Wide Motion Duo" - :mode-line-active-height 150 - :mode-line-inactive-height 150) - (large - :inherit default - :variable-pitch-family "Iosevka Comfy Wide Motion" - :default-height 170 - :mode-line-active-height 150 - :mode-line-inactive-height 150 - ) - (huge - :inherit laptop - :variable-pitch-family "Iosevka Comfy Wide Motion" - :default-height 200 - :mode-line-active-height 170 - :mode-line-inactive-height 170 - ) - (comic - :inherit default - :default-family "Comic Code" - :variable-pitch-family "Comic Code" - :fixed-pitch-family "Comic Code" - :mode-line-active-family "Comic Code" - ) - (berkeley - :inherit desktop - :default-height 150 - :mode-line-active-height 150 - :mode-line-inactive-height 150 - :default-family "Berkeley Mono" - :variable-pitch-family "Berkeley Mono" - :fixed-pitch-family "Berkeley Mono" - :mode-line-active-family "Berkeley Mono" - :mode-line-inactive-family "Berkeley Mono" - ) - (t - :default-family "Monospace" - ))) - ;; save file (setq fontaine-latest-state-file (locate-user-emacs-file "fontaine-latest-state.eld")) @@ -213,12 +155,7 @@ The exact color values are taken from the active Modus theme." (use-package rainbow-mode :ensure t) -;; Switching themes -(defun bard/disable-all-themes () - "disable all active themes." - (interactive) - (dolist (i custom-enabled-themes) - (disable-theme i))) +(global-set-key (kbd "<f6>") #'bard/select-theme) (provide 'bard-emacs-theme) |
