summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.emacs44
1 files changed, 43 insertions, 1 deletions
diff --git a/.emacs b/.emacs
index a6401a2..275518d 100644
--- 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