dotfiles

🎜 Clone'em, tweak'em, stick'em in your $HOME 🎝
git clone https://git.kevinlegouguec.net/dotfiles
Log | Files | Refs | README

commit 7a73548789c10ba2350e4adb5b5db561fd10d386
parent 6525891111bc1d339c5421d564bd3cfcb46bae13
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Sun, 22 May 2022 12:38:42 +0200

Tone down ediff faces

Diffstat:
M.emacs | 44+++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/.emacs b/.emacs @@ -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