feat(theme): improve doom-themes overrides by using a proper theme

Instead of manually just setting faces after loading a doom-themes
theme, let's use a custom override theme which we apply right after
applying any doom-themes theme.

The override theme uses various doom-color helpers, so the colors it
uses will be based on the most recently applied doom-themes theme.
This commit is contained in:
2021-04-07 23:05:16 +01:00
parent 4e50263ded
commit 5f4aa98abd
5 changed files with 142 additions and 129 deletions

View File

@@ -47,11 +47,20 @@
(interactive (list (completing-read "Choose theme: "
(siren-doom-themes-list))))
;; disable all themes
(dolist (theme custom-enabled-themes)
(when (not (string= theme "use-package"))
(disable-theme theme)))
;; load doom theme
(load-theme (if (string= (type-of theme) "string") (intern theme) theme) t)
(siren-doom-themes-overrides))
;; load overrides theme: ../../themes/siren-doom-themes-overrides-theme.el
(load-theme 'siren-doom-themes-overrides t)
;; execute custom function after loading/switching theme
(with-eval-after-load 'highlight-indent-guides
(highlight-indent-guides-auto-set-faces)))
(defun siren-doom-themes-vibrant-theme ()
(interactive)
@@ -64,131 +73,7 @@
(defun siren-doom-themes-list ()
(seq-filter
(lambda (n) (string-prefix-p "doom-" (symbol-name n)))
(custom-available-themes)))
(defun siren-doom-themes-overrides ()
(interactive)
;; Override some of doom-vibrant's colors.
(set-face-attribute 'font-lock-variable-name-face nil
:foreground (doom-lighten 'blue 0.25))
(set-face-attribute 'vertical-border nil
:foreground (doom-darken 'vertical-bar 0.3)
:background (doom-darken 'vertical-bar 0.3))
(set-face-attribute 'font-lock-comment-face nil
:foreground (doom-lighten 'comments 0.15))
(when (not (version< emacs-version "27.0"))
(set-face-attribute 'fill-column-indicator nil
:foreground (doom-lighten 'base3 0.10)))
(with-eval-after-load 'diff-hl
(set-face-attribute 'diff-hl-insert nil
:foreground (doom-blend 'vc-added 'bg 0.7)
:background (doom-blend 'vc-added 'bg 0.2))
(set-face-attribute 'diff-hl-delete nil
:foreground (doom-blend 'vc-deleted 'bg 0.7)
:background (doom-blend 'vc-deleted 'bg 0.2))
(set-face-attribute 'diff-hl-change nil
:foreground (doom-blend 'vc-modified 'bg 0.7)
:background (doom-blend 'vc-modified 'bg 0.2))
(set-face-attribute 'siren-diff-hl-insert nil
:foreground (doom-blend 'vc-added 'bg 0.7)
:background (doom-color 'bg))
(set-face-attribute 'siren-diff-hl-delete nil
:foreground (doom-blend 'vc-deleted 'bg 0.7)
:background (doom-color 'bg))
(set-face-attribute 'siren-diff-hl-change nil
:foreground (doom-blend 'vc-modified 'bg 0.7)
:background (doom-color 'bg)))
(with-eval-after-load 'diff-hl-margin
(set-face-attribute 'diff-hl-margin-insert nil
:foreground (doom-blend 'vc-added 'bg 0.6)
:background (doom-blend 'vc-added 'bg 0.1))
(set-face-attribute 'diff-hl-margin-delete nil
:foreground (doom-blend 'vc-deleted 'bg 0.7)
:background (doom-blend 'vc-deleted 'bg 0.1))
(set-face-attribute 'diff-hl-margin-change nil
:foreground (doom-blend 'vc-modified 'bg 0.5)
:background (doom-blend 'vc-modified 'bg 0.1)))
(with-eval-after-load 'git-gutter
(set-face-attribute 'git-gutter:added nil
:foreground (doom-blend 'vc-added 'bg 0.9))
(set-face-attribute 'git-gutter:deleted nil
:foreground (doom-blend 'vc-deleted 'bg 0.9))
(set-face-attribute 'git-gutter:modified nil
:foreground (doom-blend 'vc-modified 'bg 0.7)))
(with-eval-after-load 'git-gutter-fringe
(set-face-attribute 'git-gutter-fr:added nil
:foreground (doom-blend 'vc-added 'bg 0.7)
:background (doom-blend 'vc-added 'bg 0.0))
(set-face-attribute 'git-gutter-fr:deleted nil
:foreground (doom-blend 'vc-deleted 'bg 0.7)
:background (doom-blend 'vc-deleted 'bg 0.0))
(set-face-attribute 'git-gutter-fr:modified nil
:foreground (doom-blend 'vc-modified 'bg 0.7)
:background (doom-blend 'vc-modified 'bg 0.0)))
(with-eval-after-load 'hideshowvis
(set-face-attribute 'hideshowvis-hidable-face nil
:foreground (doom-color 'base7)))
(with-eval-after-load 'auto-highlight-symbol
(set-face-attribute 'ahs-definition-face nil
:foreground 'unspecified
:background (doom-lighten 'bg 0.1)
:underline t)
(set-face-attribute 'ahs-edit-mode-face nil
:foreground (doom-lighten 'fg 1.0)
:background (doom-darken 'red 0.25))
(set-face-attribute 'ahs-face nil
:foreground 'unspecified
:background (doom-lighten 'bg 0.1))
(set-face-attribute 'ahs-plugin-bod-face nil
:foreground 'unspecified
:background (doom-color 'bg-alt))
(set-face-attribute 'ahs-plugin-defalt-face nil
:foreground 'unspecified
:background (doom-color 'bg-alt))
(set-face-attribute 'ahs-plugin-whole-buffer-face nil
:foreground 'unspecified
:background (doom-color 'bg-alt))
(set-face-attribute 'ahs-warning-face nil
:foreground (doom-color 'red)
:background 'unspecified))
(with-eval-after-load 'dired+
(set-face-attribute 'diredp-dir-heading nil
:weight 'bold
:foreground (doom-color 'magenta))
(set-face-attribute 'diredp-dir-name nil
:weight 'bold
:foreground (doom-lighten 'magenta 0.25))
(set-face-attribute 'diredp-flag-mark nil
:foreground (doom-color 'green)
:background (doom-blend 'bg 'orange 0.5))
(set-face-attribute 'diredp-flag-mark-line nil
:foreground (doom-color 'base8)
:background (doom-blend 'bg 'orange 0.7))
(set-face-attribute 'diredp-deletion nil
:foreground (doom-color 'yellow)
:background (doom-darken 'red 0.25))
(set-face-attribute 'diredp-deletion-file-name nil
:foreground (doom-color 'red))
(set-face-attribute 'diredp-compressed-file-name nil
:foreground (doom-color 'blue)))
(with-eval-after-load 'highlight-indent-guides
(highlight-indent-guides-auto-set-faces))
(with-eval-after-load 'zoom-window
(setq zoom-window-mode-line-color (doom-blend 'magenta 'bg 0.2)))
(with-eval-after-load 'fill-column-indicator
(setq fci-rule-color (doom-lighten (doom-color 'base3) 0.10)))))
(custom-available-themes))))
(provide 'siren-doom-themes)
;;; siren-doom-themes.el ends here