diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2022-05-22 12:38:42 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2022-05-22 12:39:14 +0200 |
| commit | 7a73548789c10ba2350e4adb5b5db561fd10d386 (patch) | |
| tree | 75c7e1cadaae0761afb4f42425b9f1482448e5a4 | |
| parent | 6525891111bc1d339c5421d564bd3cfcb46bae13 (diff) | |
| download | dotfiles-7a73548789c10ba2350e4adb5b5db561fd10d386.tar.xz | |
Tone down ediff faces
| -rw-r--r-- | .emacs | 44 |
1 files changed, 43 insertions, 1 deletions
@@ -26,6 +26,46 @@ ;; Examples: erc-modules, git-commit-setup-hook, package-archives. (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) + +;; Theming + +;; AFAICT `modus-themes-deuteranopia' does not compose with +;; `modus-themes-diffs'. I like the red/blue palette, but I'd also +;; like to get desaturated backgrounds… *and* I'd also like +;; foregrounds to remain unset to keep syntax highlighting. Tough +;; customer, I know 😕 + +(defun my/modus-ediff-bg (face) + (require 'color) + (let ((old-bg (face-background face nil t))) + (if (equal (modus-themes--current-theme) 'modus-vivendi) + (color-darken-name old-bg 25) + (color-lighten-name old-bg 12)))) + +(defun my/modus-ediff-set-face (face) + (set-face-attribute + face nil + :inherit 'unspecified + :foreground 'unspecified + :background (my/modus-ediff-bg face))) + +(defun my/modus-ediff-face-list () + (require 'ediff-init) + (let ((kinds '("current" "fine")) + (targets '("A" "B" "C" "Ancestor"))) + (mapcan + (lambda (target) + (mapcar + (lambda (kind) + (let ((face-name (format "ediff-%s-diff-%s" kind target))) + (or (intern-soft face-name) + (error "Cannot find face named %s" face-name)))) + kinds)) + targets))) + +(defun my/modus-ediff () + (mapc 'my/modus-ediff-set-face (my/modus-ediff-face-list))) + (when (>= emacs-major-version 28) (setq modus-themes-bold-constructs t modus-themes-deuteranopia t @@ -40,7 +80,9 @@ modus-themes-prompts '(background) modus-themes-region '(bg-only) modus-themes-variable-pitch-ui t) - (load-theme 'modus-vivendi)) + (load-theme 'modus-vivendi) + (my/modus-ediff) + (add-hook 'modus-themes-after-load-theme-hook 'my/modus-ediff)) ;; Key bindings |
