Buffers that show differences between versions of a file or buffer, such
as in diff-mode
and ediff
always use color-coded background and
foreground combinations.
User may, however, prefer a style that removes the color-coded
backgrounds from regular changes while keeping them for word-wise (aka
“refined”) changes—backgrounds for word-wise diffs are helpful in
context. To make this happen, one can use the modus-themes-with-colors
macro (Face specs at scale using the themes’ palette):
(defun my-modus-themes-custom-faces () (modus-themes-with-colors (custom-set-faces `(modus-themes-diff-added ((,class :background unspecified :foreground ,green))) ; OR ,blue for deuteranopia `(modus-themes-diff-changed ((,class :background unspecified :foreground ,yellow))) `(modus-themes-diff-removed ((,class :background unspecified :foreground ,red))) `(modus-themes-diff-refine-added ((,class :background ,bg-diff-added :foreground ,fg-diff-added))) ;; `(modus-themes-diff-refine-added ((,class :background ,bg-diff-added-deuteran :foreground ,fg-diff-added-deuteran))) `(modus-themes-diff-refine-changed ((,class :background ,bg-diff-changed :foreground ,fg-diff-changed))) `(modus-themes-diff-refine-removed ((,class :background ,bg-diff-removed :foreground ,fg-diff-removed))) `(modus-themes-diff-focus-added ((,class :background ,bg-dim :foreground ,green))) ; OR ,blue for deuteranopia `(modus-themes-diff-focus-changed ((,class :background ,bg-dim :foreground ,yellow))) `(modus-themes-diff-focus-removed ((,class :background ,bg-dim :foreground ,red))) `(modus-themes-diff-heading ((,class :background ,bg-alt :foreground ,fg-main))) `(diff-indicator-added ((,class :foreground ,green))) ; OR ,blue for deuteranopia `(diff-indicator-changed ((,class :foreground ,yellow))) `(diff-indicator-removed ((,class :foreground ,red))) `(magit-diff-added ((,class :background unspecified :foreground ,green-faint))) `(magit-diff-changed ((,class :background unspecified :foreground ,yellow-faint))) `(magit-diff-removed ((,class :background unspecified :foreground ,red-faint))) `(magit-diff-context-highlight ((,class :background ,bg-dim :foreground ,fg-dim)))))) ;; This is so that the changes persist when switching between ;; `modus-operandi' and `modus-vivendi'. (add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-custom-faces)
This used to be an optional style of modus-themes-diffs
, but has been
removed since version ‘2.0.0’ to ensure that the accessibility standard
and aesthetic quality of the themes is not compromised.