diff options
author | JSDurand <mmemmew@gmail.com> | 2022-12-25 13:29:53 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2022-12-25 13:29:53 +0800 |
commit | b3debc853aa22b87b281af47bc5c67d748443744 (patch) | |
tree | b6e920a710dcb520b60f699742164d06cac72cbf | |
parent | 9c66616bf919440f7238801be3fadca2486cc6a6 (diff) |
theme + modeline: adapt to the update of modus-themes
* modeline.el: Basically adjust colors to fit the new theme.
* theme.el (modus-themes-headings): Make the headings ultra-bold.
(modus-themes-after-load-theme-hook, durand-custom-face): To change
the mode-line face via a hook.
(modus-vivendi-tinted, modus-vivendi): I use the un-tinted version
now.
-rw-r--r-- | modeline.el | 79 | ||||
-rw-r--r-- | theme.el | 56 |
2 files changed, 93 insertions, 42 deletions
diff --git a/modeline.el b/modeline.el index eb30b93..683b09d 100644 --- a/modeline.el +++ b/modeline.el @@ -269,21 +269,24 @@ MAP is the local keymap of the text." (cond ((and buffer-file-name (buffer-modified-p)) (format-mode-line "M" (cond (active-p - 'compilation-error) + (modus-themes-with-colors + `(:foreground + ,magenta-intense)) + ) (t 'mode-line-inactive))))) ;; read-only? (cond (buffer-read-only (format-mode-line "R" (cond (active-p - 'modus-themes-fg-cyan-intense) + (modus-themes-with-colors + `(:foreground ,red-intense))) (t 'mode-line-inactive))))) ;; narrow? (cond ((buffer-narrowed-p) (format-mode-line "N" (cond - (active-p - 'compilation-warning) + (active-p 'warning) (t 'mode-line-inactive)))))))) ;;;; Buffer position @@ -297,8 +300,7 @@ MAP is the local keymap of the text." (modeline-propertize (propertize (let* ((current (pdf-view-current-page)) - (total (pdf-info-number-of-pages)) - ) + (total (pdf-info-number-of-pages))) (concat "P." (number-to-string current) @@ -468,12 +470,23 @@ This will be displayed in the mode line." ;;;; Major mode +(declare-function + #'modus-themes-with-colors + (expand-file-name + "modus-themes.el" + "/Users/durand/elisp_packages/protesilaos/modus-themes/") + (&rest body) t) + ;;;###autoload (defun modeline-format-major-mode () "The major mode to display in the mode line." (declare (pure t) (side-effect-free t)) - (let ((face (cond ((modeline-active-window-p) 'doom-modeline-buffer-major-mode) - ('mode-line-inactive)))) + (let ((face (cond ((modeline-active-window-p) 'mode-line-active) + ('mode-line-inactive))) + (mode-string-face + (cond + ((modeline-active-window-p) 'mode-line-active) + ('mode-line-inactive)))) (concat (modeline-propertize (format-mode-line '("%m") face) @@ -482,7 +495,7 @@ This will be displayed in the mode line." mode-line-major-mode-keymap) (modeline-spc) (modeline-propertize - (format-mode-line global-mode-string face)) + (format-mode-line global-mode-string mode-string-face)) (modeline-spc)))) ;;;; VCS @@ -496,7 +509,8 @@ This will be displayed in the mode line." ;;;###autoload (defun modeline-update-vcs-str (&rest _) - "Update the version control system information to be displayed on the mode line." + "Update the version control system information to be displayed +on the mode line." (let ((bfn (buffer-file-name))) (setq modeline-vcs-str @@ -504,23 +518,27 @@ This will be displayed in the mode line." ((and vc-mode bfn) (let* ((backend (vc-backend bfn)) (state (vc-state bfn backend)) - (indicator (cond - ((memq state '(added edited)) - (format-mode-line - "* " 'doom-modeline-info)) - ((eq state 'needs-merge) - (format-mode-line - "? " 'doom-modeline-info)) - ((eq state 'needs-update) - (format-mode-line - "! " 'doom-modeline-warning)) - ((memq state '(removed conflict unregistered)) - (format-mode-line - "! " 'doom-modeline-urgent)) - (t (format-mode-line - "@ " 'doom-modeline-info)))) + (error-faces (list 'removed 'conflict 'unregistered)) + (face (cond + ((memq state '(added edited)) 'warning) + ((eq state 'needs-merge) 'compilation-info) + ((eq state 'needs-update) 'warning) + ((memq state error-faces) 'error) + ('success))) + (indicator + (cond + ((memq state '(added edited)) + (format-mode-line "* " face)) + ((eq state face) + (format-mode-line "? " face)) + ((eq state face) + (format-mode-line "! " face)) + ((memq state '(removed conflict unregistered)) + (format-mode-line "! " face)) + (t (format-mode-line "@ " face)))) (str (cond (vc-display-status - (substring vc-mode (+ (cond ((eq backend 'Hg) 2) + (substring vc-mode + (+ (cond ((eq backend 'Hg) 2) (t 3)) 2))) (t "")))) @@ -532,12 +550,7 @@ This will be displayed in the mode line." (concat (substring str 0 (- modeline-vcs-length-max 3)) "...")) (t str)) - 'face (cond - ((eq state 'needs-update) - 'doom-modeline-warning) - ((memq state '(removed conflict unregistered)) - 'doom-modeline-urgent) - (t 'doom-modeline-info)))))) + 'face face)))) (t ""))))) (add-hook 'find-file-hook #'modeline-update-vcs-str) @@ -574,7 +587,7 @@ This will be displayed in the mode line." (modeline-propertize (propertize current-input-method-title - 'face (cond ((modeline-active-window-p) 'doom-modeline-input-method) + 'face (cond ((modeline-active-window-p) 'compilation-info) (t 'mode-line-inactive))) nil (format "Current input method: %s\nmouse-2: Disable input method\nmouse-3: Describe current input method" @@ -16,11 +16,22 @@ ;; borders ;; (list 'border-mode-line-active 'bg-mode-line-active) ;; (list 'border-mode-line-inactive 'bg-mode-line-inactive) + ;; subtle line numbers + (list 'bg-line-number-inactive 'bg-dim) + (list 'fg-line-number-inactive 'fg-dim) + (list 'bg-line-number-active 'bg-main) + (list 'fg-line-number-active 'fg-main) + ;; comment + (list 'comment 'yellow-faint) ;; blue cursor - (list 'cursor 'blue-cooler) - ;; headings + (list 'cursor 'fg-main) ;; I prefer the old color for heading 1 - (list 'heading-1 "#b6a0ff") + (list 'fg-heading-1 "#b6a0ff") + ;; link background and bold + (list 'bg-link 'bg-dim) + (list 'bg-link-visited 'bg-cyan-nuanced) + (list 'bg-link-symbolic 'bg-red-nuanced) + (list 'underline-link t) ;; Trying to imitate the old line numbers color (list 'fg-line-number-active 'blue-warmer))))) (list "modus-vivendi" "modus-vivendi-tinted")) @@ -35,11 +46,11 @@ (setq modus-themes-headings (list (list 0 'variable-pitch 'ultrabold 1.3) - (list 1 1.05 'variable-pitch) - (list 2 1.1 'variable-pitch) - (list 3 1.15 'variable-pitch) - (list 4 1.2 'variable-pitch) - (list 5 1.3 'variable-pitch) + (list 1 1.05 'variable-pitch 'ultrabold) + (list 2 1.1 'variable-pitch 'extrabold) + (list 3 1.15 'variable-pitch 'extrabold) + (list 4 1.2 'variable-pitch 'bold) + (list 5 1.3 'variable-pitch 'bold) (list 'agenda-date 'ultrabold) (list 'agenda-structure 'variable-pitch 'ultrabold))) @@ -95,10 +106,37 @@ ;; (setq modus-themes-mode-line '(3d borderless padded)) +;; To change the mode-line face via a hook. + +(defun durand-custom-face (&rest _args) + "Change appearances of some themes." + (modus-themes-with-colors + (custom-set-faces + (list 'mode-line + (list + (list + t + :box (list :line-width 4 + :color bg-mode-line-active + :style 'released-button) + :background bg-mode-line-active + :foreground fg-mode-line-active))) + (list 'mode-line-inactive + (list + (list + t + :box (list :line-width 4 + :color bg-mode-line-inactive + :style 'released-button) + :background bg-mode-line-inactive + :foreground fg-mode-line-inactive)))))) + +(remove-hook 'modus-themes-after-load-theme-hook #'durand-custom-face) + ;;;; Links ;; Fine, but I cannot set the background color now? ;; (setq modus-themes-links '(background bold)) ;;; Load the theme -(modus-themes-load-theme 'modus-vivendi-tinted) +(modus-themes-load-theme 'modus-vivendi) |