平衡点


2021/09/12 [長年日記]

_ modus-theme

Emacs 28 から built-in となる予定の modus-themes(gitlab:modus-theme) がなかなか良い感じであったので, これまでチマチマと作成していたテーマからエイヤッっと乗り換えてみた.

default の font-lock- の組み合わせがあんまり気にくわなかったので 入れ替えたり継ぎ足したりして, 以下の様に.

(leaf modus-themes
  :ensure t
  :bind ("<f5>" . modus-themes-toggle)
  :init
  (modus-themes-load-themes)
  :config
  (modus-themes-load-vivendi)
  :preface
  (defun my:set-background (&optional frame)
    "Unsets the background color for transparency"
    (or frame
        (setq frame (selected-frame)))
    (if (display-graphic-p frame)
        (progn
          (set-frame-parameter nil 'alpha '(80  50))
          (add-to-list 'default-frame-alist '(alpha 80 50)))
      (set-face-background 'default "unspecified-bg" frame)))
  ;; (my:modus-themes-custom-faces)
  (defun my:modus-themes-custom-faces ()
    (modus-themes-with-colors
      (custom-set-faces
       ;;
       ;; `(hl-line ((,class :background "#556b2f")))
       ;;
       ;; preprocessor → builtin
       `(font-lock-builtin-face ((,class ,@(modus-themes--syntax-extra
                                              blue-alt-other blue-alt-other-faint
                                              blue-alt blue-alt-faint))))
       ;; preprocessor:: red
       `(font-lock-preprocessor-face ((,class :inherit modus-themes-bold
                                         ,@(modus-themes--syntax-extra
                                            red-alt red-alt-faint
                                            red-intense red-faint))))
       ;; constant → function
       `(font-lock-function-name-face ((,class ,@(modus-themes--syntax-extra
                                             blue-alt-other blue-alt-other-faint
                                             magenta-alt-other magenta-alt-other-faint))))
       ;; constant :: custom
       `(font-lock-constant-face ((,class ,@(modus-themes--syntax-extra
                                             orange-intense orange-intense
                                             orange-intense orange-intense))))
       ;; keyword → string
       `(font-lock-string-face ((,class :inherit modus-themes-bold
                                        ,@(modus-themes--syntax-extra
                                           magenta-alt-other magenta-alt-other-faint
                                           cyan cyan-faint))))
       ;; keyword :: custom
       `(font-lock-keyword-face ((,class :inherit modus-themes-bold
                                         ,@(modus-themes--syntax-extra
                                            red-alt-other red-alt-other-faint
                                            red-alt-other red-alt-other-faint))))
       ;; type → negation-char
       `(font-lock-negation-char-face ((,class :inherit modus-themes-bold
                                      ,@(modus-themes--syntax-foreground
                                         cyan-alt-other cyan-alt-faint))))
       ;; type :: custom
       `(font-lock-type-face ((,class :inherit modus-themes-bold
                                      ,@(modus-themes--syntax-foreground
                                         yellow-intense yellow-faint))))
       `(font-lock-regexp-grouping-backslash ((,class :inherit bold
                                                      ,@(modus-themes--syntax-string
                                                         fg-escape-char-backslash fg-escape-char-backslash
                                                         fg-escape-char-backslash fg-escape-char-backslash
                                                         ))))
       `(font-lock-regexp-grouping-construct ((,class :inherit bold
                                                      ,@(modus-themes--syntax-string
                                                         fg-escape-char-construct fg-escape-char-construct
                                                         fg-escape-char-construct fg-escape-char-construct
                                                         ))))
       ;; ちょっと気に食わないので…
       `(org-agenda-date-weekend
         ((,class :inherit 'default :foreground "#ff7f7f" :bold t)))
       `(org-agenda-date
         ((,class :inherit 'default :foreground "#ffffff" :bold t )))
       `(org-agenda-date-today
         ((,class :inherit 'default :foreground "#ffffff" :bold t :underline t)))
       ;; 不要
       `(org-block-begin-line ((,class :background nil)))
       `(org-block-end-line ((,class :background nil)))
       ;; shell に揃える.
       `(dired-directory ((,class :foreground "#7f7fff" :bold t)))
       ;;
       ;; wanderlust
       `(wl-highlight-folder-closed-face                  ((,class :foreground "#4cff4c")))
       `(wl-highlight-folder-few-face                     ((,class :foreground "#ff4c4c")))
       `(wl-highlight-folder-killed-face                  ((,class :foreground "#4f4f4f")))
       `(wl-highlight-folder-many-face                    ((,class :foreground "#ff4cff")))
       `(wl-highlight-folder-opened-face                  ((,class :foreground "#4cffff")))
       `(wl-highlight-folder-path-face                    ((,class :underline t :bold t)))
       `(wl-highlight-folder-unknown-face                 ((,class :foreground "#4cffff")))
       `(wl-highlight-folder-unread-face                  ((,class :foreground "#4c4cff")))
       `(wl-highlight-folder-zero-face                    ((,class :foreground "#f6f3e8")))
       `(wl-highlight-message-citation-header             ((,class :foreground "#7fff7f")))
       `(wl-highlight-message-cited-text-1                ((,class :foreground "#7fff7f")))
       `(wl-highlight-message-cited-text-2                ((,class :foreground "#FFE57F")))
       `(wl-highlight-message-cited-text-3                ((,class :foreground "#7f7fff")))
       `(wl-highlight-message-cited-text-4                ((,class :foreground "#A7FDEB")))
       `(wl-highlight-message-cited-text-5                ((,class :foreground "#ff7fff")))
       `(wl-highlight-message-cited-text-6                ((,class :foreground "#ff7f7f")))
       `(wl-highlight-message-cited-text-7                ((,class :foreground "#5CF19E")))
       `(wl-highlight-message-cited-text-8                ((,class :foreground "#FFD740")))
       `(wl-highlight-message-cited-text-9                ((,class :foreground "#4c4cff")))
       `(wl-highlight-message-cited-text-10               ((,class :foreground "#4cffff")))
       `(wl-highlight-message-header-contents             ((,class :foreground "#5CF19E")))
       `(wl-highlight-message-headers                     ((,class :foreground "#64FCDA" :bold t)))
       `(wl-highlight-message-important-header-contents   ((,class :foreground "#ff4cff" :bold t)))
       `(wl-highlight-message-important-header-contents2  ((,class :foreground "#ff4cff" :bold t)))
       `(wl-highlight-message-signature                   ((,class :foreground "#afafaf")))
       `(wl-highlight-message-unimportant-header-contents ((,class :foreground "#afafaf")))
       `(wl-highlight-summary-answered-face               ((,class :foreground "#4cff4c")))
       `(wl-highlight-summary-deleted-face                ((,class :foreground "#4c4caa")))
       `(wl-highlight-summary-disposed-face               ((,class :foreground "#7f7faa")))
       `(wl-highlight-summary-flagged-face                ((,class :foreground "#FFE57F" :bold t)))
       `(wl-highlight-summary-high-unread-face            ((,class :foreground "#ff4c4c")))
       `(wl-highlight-summary-low-unread-face             ((,class :foreground "#ff4c4c")))
       `(wl-highlight-summary-normal-face                 ((,class :foreground "#f6f3e8")))
       `(wl-highlight-summary-refiled-face                ((,class :foreground "#7f7fff")))
       `(wl-highlight-summary-spam-face                   ((,class :foreground "#ff4cff" :bold t)))
       `(wl-highlight-summary-thread-top-face             ((,class :foreground "#f6f3e8")))
       `(wl-highlight-summary-unread-face                 ((,class :foreground "#ff4c4c")))
       ;; (wl-highlight-header-separator-face               :foreground "#f6f3e8")
       ;; (wl-highlight-logo-face                           :foreground "#f6f3e8")
       ;; (wl-highlight-summary-copied-face                 :foreground "#f6f3e8")
       ;; (wl-highlight-summary-displaying-face             :foreground "#f6f3e8")
       ;; (wl-highlight-summary-resend-face                 :foreground "#f6f3e8")
       ;; (wl-highlight-summary-prefetch-face               :foreground "#f6f3e8")
       ;; (wl-highlight-summary-target-face                 :foreground "#f6f3e8")
       ;; (wl-highlight-summary-temp-face                   :foreground "#f6f3e8")
       ;; (wl-highlight-summary-new-face                    :foreground "#f6f3e8")
       ;; (wl-highlight-summary-killed-face                 :foreground "#f6f3e8")
       ;; (wl-highlight-summary-low-read-face               :foreground "#f6f3e8")
       ;; (wl-highlight-thread-indent-face                  :foreground "#f6f3e8")
       ;; (wl-highlight-summary-forwarded-face              :foreground "#f6f3e8")
       ;; (wl-highlight-summary-high-read-face              :foreground "#f6f3e8")
       ;; (wl-message-header-narrowing-face                 :foreground "#f6f3e8")
       ;; (wl-summary-persistent-mark-face                  :foreground "#f6f3e8")
       ;;
       )))
  :advice
  ((:after
    modus-themes-load-vivendi
    my:set-background)
   (:after
    modus-themes-load-operandi
    (lambda () (set-face-background 'default "#FFFFFF" )))
   )
  :hook
  `((modus-themes-after-load-theme-hook
     . (lambda ()
         (my:modus-themes-custom-faces)
         ;; (my:set-background)
         ))
    ;; (window-setup-hook . my:set-background)
    ;; (tty-setup-hook . my:set-background)
    )
  :custom
  `(
    (modus-themes-inhibit-reload          . t)
    (modus-themes-success-deuteranopia    . nil) ;; default
    (modus-themes-bold-constructs         . nil) ;; default
    (modus-themes-italic-constructs       . nil) ;; default
    (modus-themes-syntax                  . '(alt-syntax green-strings))
    (modus-themes-no-mixed-fonts          . t)
    (modus-themes-links                   . '(neutral-underline bold))
    (modus-themes-prompts                 . '(intense bold))
    (modus-themes-mode-line               . '(borderless accented))
    (modus-themes-tabs-accented           . t)
    (modus-themes-completions             . nil) ;; default
    (modus-themes-mail-citations          . nil) ;; default
    (modus-themes-fringes                 . nil) ;; default
    (modus-themes-lang-checkers           . '(straight-underline intense))
    (modus-themes-hl-line                 . '(accented intense)) ;; → custom
    (modus-themes-subtle-line-numbers     . nil) ;; default
    (modus-themes-paren-match             . '(bold intense))
    (modus-themes-region                  . '(accented no-extend))
    (modus-themes-diffs                   . nil) ;; default
    (modus-themes-org-blocks              . nil) ;; default
    (modus-themes-org-agenda              . '((t . nil)))
    (modus-themes-headings                . '((t . rainbow)))
    (modus-themes-scale-headings          . nil)
    (modus-themes-variable-pitch-ui       . nil)
    (modus-themes-variable-pitch-headings . nil)
    ;; (modus-themes-vivendi-color-overrides
    ;;  . '(
    ;;      (bg-hl-line-intense-accent . "#556b2f")
    ;;      ))
    )
  )

背景透過しているので, operandi だと上手く表示できなかったりするけどまあ, それはそれとして(vivendi の時だけ背景透過, とかできるかな?). (追記) advice :after で背景色だけ設定するようにしてみた. まあ, operandi は殆ど使わないケド.

  • Wanderlust の face(多過ぎぃ!)は, 既存のコピペ.
  • カスタマイズしている所も, 本当はちゃんと色を確認しないとアカンのだが, 手付かず.

流石に built-in の予定だけあって, 対応しているパッケージが多いのが良い.


連絡先など
最近の日記