[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/modus-vivendi-theme 88489ed 014/110: New customisation
From: |
Stefan Monnier |
Subject: |
[elpa] externals/modus-vivendi-theme 88489ed 014/110: New customisation option for SUBTLE DIFFS |
Date: |
Wed, 29 Apr 2020 21:39:57 -0400 (EDT) |
branch: externals/modus-vivendi-theme
commit 88489edbd17d2f3a5d30d98cf27092d4aa0b2010
Author: Protesilaos Stavrou <address@hidden>
Commit: Protesilaos Stavrou <address@hidden>
New customisation option for SUBTLE DIFFS
As with all user-facing options, this is off (`nil') by default.
Quoting from the documentation in the README:
Display `diff-mode' and `magit' diff buffers with fewer background
colours (the default is to use colour-coded backgrounds for
line-wise highlights). This means that only accented foreground
values are used for affected lines: green for added, red for
removed, yellow for changed. "Refined" changes (word-wise
highlights) still use a background value which is, nonetheless, more
subtle than its default equivalent. For `magit', an extra set of
tweaks are introduced for the effect of highlighting the current
diff hunk, so as to remain consistent with the overall experience of
this tool.
Also check issue 33 for screen shots:
https://gitlab.com/protesilaos/modus-themes/-/issues/33
---
README.org | 13 ++++++++
modus-operandi-theme.el | 80 ++++++++++++++++++++++++++++++++++++++-----------
modus-vivendi-theme.el | 80 ++++++++++++++++++++++++++++++++++++++-----------
3 files changed, 137 insertions(+), 36 deletions(-)
diff --git a/README.org b/README.org
index 17cf79a..59633ed 100644
--- a/README.org
+++ b/README.org
@@ -160,6 +160,19 @@ theme of your choice):
(setq modus-operandi-theme-distinct-org-blocks nil)
(setq modus-vivendi-theme-distinct-org-blocks nil)
+
+;; Display `diff-mode' and `magit' diff buffers with fewer background
+;; colours (the default is to use colour-coded backgrounds for line-wise
+;; highlights). This means that only accented foreground values are
+;; used for affected lines: green for added, red for removed, yellow for
+;; changed. "Refined" changes (word-wise highlights) still use a
+;; background value which is, nonetheless, more subtle than its default
+;; equivalent. For `magit' an extra set of tweaks are introduced for
+;; the effect of highlighting the current diff hunk, so as to remain
+;; consistent with the overall experience of this tool.
+(setq modus-operandi-theme-subtle-diffs nil)
+
+(setq modus-vivendi-theme-subtle-diffs nil)
#+END_SRC
*NOTE* that all customisation options must be declared /before/ loading
diff --git a/modus-operandi-theme.el b/modus-operandi-theme.el
index 04acd57..1d339ec 100644
--- a/modus-operandi-theme.el
+++ b/modus-operandi-theme.el
@@ -45,6 +45,7 @@
;; modus-operandi-theme-scale-headings
;; modus-operandi-theme-visible-fringes
;; modus-operandi-theme-distinct-org-blocks
+;; modus-operandi-theme-subtle-diffs
;;
;; The default scale is as follows (it can be customised as well):
;;
@@ -378,6 +379,21 @@ between foreground and background is >= 7:1)."
"Use a distinct background for `org-mode' source blocks."
:type 'boolean)
+(defcustom modus-operandi-theme-subtle-diffs nil
+ "Use fewer background colours in `diff-mode'."
+ :type 'boolean)
+
+(defmacro modus-operandi-theme-diffs (subtle-bg subtle-fg intense-bg
intense-fg)
+ "Colour combinations for `modus-operandi-theme-subtle-diffs'.
+
+SUBTLE-BG should be similar or the same as the main background
+SUBTLE-FG should be an appropriate accent value
+INTENSE-BG should be one of the dedicated backgrounds for diffs
+INTENSE-FG should be one of the dedicated foregrounds for diffs"
+ (list 'if 'modus-operandi-theme-subtle-diffs
+ (list 'list :background subtle-bg :foreground subtle-fg)
+ (list 'list :background intense-bg :foreground intense-fg)))
+
;; Define colour palette. Each colour must have a >= 7:1 contrast
;; ratio relative to the foreground/background colour it is rendered
;; against.
@@ -1011,22 +1027,36 @@ between foreground and background is >= 7:1)."
`(diff-hl-insert ((,class (:inherit modus-theme-fringe-green))))
`(diff-hl-reverted-hunk-highlight ((,class (:inherit
modus-theme-intense-blue))))
;;;; diff-mode
- `(diff-added ((,class (:inherit modus-theme-diff-focus-added))))
- `(diff-changed ((,class (:inherit modus-theme-diff-focus-changed))))
+ `(diff-added ((,class ,(modus-operandi-theme-diffs
+ bg-main green
+ bg-diff-focus-added fg-diff-focus-added))))
+ `(diff-changed ((,class ,(modus-operandi-theme-diffs
+ bg-main yellow
+ bg-diff-focus-changed fg-diff-focus-changed))))
`(diff-context ((,class (:foreground ,fg-alt))))
`(diff-file-header ((,class (:foreground ,blue :weight bold))))
`(diff-function ((,class (:foreground ,fg-special-cold))))
`(diff-header ((,class (:foreground ,blue-nuanced))))
- `(diff-hunk-header ((,class (:inherit modus-theme-diff-heading :weight
bold))))
+ `(diff-hunk-header ((,class ,(modus-operandi-theme-diffs
+ bg-alt blue-alt
+ bg-diff-heading fg-diff-heading))))
`(diff-index ((,class (:foreground ,blue-alt :weight bold))))
- `(diff-indicator-added ((,class (:inherit diff-added))))
- `(diff-indicator-changed ((,class (:inherit diff-changed))))
- `(diff-indicator-removed ((,class (:inherit diff-removed))))
- `(diff-nonexistent ((,class (:inherit modus-theme-intense-neutral :weight
bold))))
- `(diff-refine-added ((,class (:inherit modus-theme-diff-refine-added))))
- `(diff-refine-changed ((,class (:inherit modus-theme-diff-refine-changed))))
- `(diff-refine-removed ((,class (:inherit modus-theme-diff-refine-removed))))
- `(diff-removed ((,class (:inherit modus-theme-diff-focus-removed))))
+ `(diff-indicator-added ((,class (:inherit modus-theme-diff-focus-added))))
+ `(diff-indicator-changed ((,class (:inherit
modus-theme-diff-focus-changed))))
+ `(diff-indicator-removed ((,class (:inherit
modus-theme-diff-focus-removed))))
+ `(diff-nonexistent ((,class (:inherit modus-theme-neutral :weight bold))))
+ `(diff-refine-added ((,class ,(modus-operandi-theme-diffs
+ bg-diff-added fg-diff-added
+ bg-diff-refine-added fg-diff-refine-added))))
+ `(diff-refine-changed ((,class ,(modus-operandi-theme-diffs
+ bg-diff-changed fg-diff-changed
+ bg-diff-refine-changed fg-diff-refine-changed))))
+ `(diff-refine-removed ((,class ,(modus-operandi-theme-diffs
+ bg-diff-removed fg-diff-removed
+ bg-diff-refine-removed fg-diff-refine-removed))))
+ `(diff-removed ((,class ,(modus-operandi-theme-diffs
+ bg-main red
+ bg-diff-focus-removed fg-diff-focus-removed))))
;;;; dim-autoload
`(dim-autoload-cookie-line ((,class (:foreground ,fg-alt :slant
,modus-theme-slant))))
;;;; dired
@@ -1875,12 +1905,22 @@ between foreground and background is >= 7:1)."
`(magit-branch-upstream ((,class (:slant italic))))
`(magit-cherry-equivalent ((,class (:background ,bg-main :foreground
,magenta-intense))))
`(magit-cherry-unmatched ((,class (:background ,bg-main :foreground
,cyan-intense))))
- `(magit-diff-added ((,class (:inherit modus-theme-diff-added))))
- `(magit-diff-added-highlight ((,class (:inherit
modus-theme-diff-focus-added))))
- `(magit-diff-base ((,class (:inherit modus-theme-diff-changed))))
- `(magit-diff-base-highlight ((,class (:inherit
modus-theme-diff-focus-changed))))
+ `(magit-diff-added ((,class ,(modus-operandi-theme-diffs
+ bg-main green
+ bg-diff-added fg-diff-added))))
+ `(magit-diff-added-highlight ((,class ,(modus-operandi-theme-diffs
+ bg-dim green
+ bg-diff-focus-added
fg-diff-focus-added))))
+ `(magit-diff-base ((,class ,(modus-operandi-theme-diffs
+ bg-main yellow
+ bg-diff-changed fg-diff-changed))))
+ `(magit-diff-base-highlight ((,class ,(modus-operandi-theme-diffs
+ bg-dim yellow
+ bg-diff-focus-changed
fg-diff-focus-changed))))
`(magit-diff-context ((,class (:foreground ,fg-alt))))
- `(magit-diff-context-highlight ((,class (:background ,bg-inactive
:foreground ,fg-inactive))))
+ `(magit-diff-context-highlight ((,class ,(modus-operandi-theme-diffs
+ bg-dim fg-dim
+ bg-inactive fg-inactive))))
`(magit-diff-file-heading ((,class (:foreground ,fg-special-cold :weight
bold))))
`(magit-diff-file-heading-highlight ((,class (:inherit
modus-theme-special-cold :weight bold))))
`(magit-diff-file-heading-selection ((,class (:background ,bg-alt
:foreground ,cyan))))
@@ -1890,8 +1930,12 @@ between foreground and background is >= 7:1)."
`(magit-diff-hunk-region ((,class (:weight bold))))
`(magit-diff-lines-boundary ((,class (:background ,fg-main))))
`(magit-diff-lines-heading ((,class (:inherit modus-theme-refine-magenta))))
- `(magit-diff-removed ((,class (:inherit modus-theme-diff-removed))))
- `(magit-diff-removed-highlight ((,class (:inherit
modus-theme-diff-focus-removed))))
+ `(magit-diff-removed ((,class ,(modus-operandi-theme-diffs
+ bg-main red
+ bg-diff-focus-removed
fg-diff-focus-removed))))
+ `(magit-diff-removed-highlight ((,class ,(modus-operandi-theme-diffs
+ bg-dim red
+ bg-diff-focus-removed
fg-diff-focus-removed))))
`(magit-diffstat-added ((,class (:foreground ,green))))
`(magit-diffstat-removed ((,class (:foreground ,red))))
`(magit-dimmed ((,class (:foreground ,fg-alt))))
diff --git a/modus-vivendi-theme.el b/modus-vivendi-theme.el
index ccd3549..dac4fea 100644
--- a/modus-vivendi-theme.el
+++ b/modus-vivendi-theme.el
@@ -45,6 +45,7 @@
;; modus-vivendi-theme-scale-headings
;; modus-vivendi-theme-visible-fringes
;; modus-vivendi-theme-distinct-org-blocks
+;; modus-vivendi-theme-subtle-diffs
;;
;; The default scale is as follows (it can be customised as well):
;;
@@ -378,6 +379,21 @@ between foreground and background is >= 7:1)."
"Use a distinct background for `org-mode' source blocks."
:type 'boolean)
+(defcustom modus-vivendi-theme-subtle-diffs nil
+ "Use fewer background colours in `diff-mode'."
+ :type 'boolean)
+
+(defmacro modus-vivendi-theme-diffs (subtle-bg subtle-fg intense-bg intense-fg)
+ "Colour combinations for `modus-vivendi-theme-subtle-diffs'.
+
+SUBTLE-BG should be similar or the same as the main background
+SUBTLE-FG should be an appropriate accent value
+INTENSE-BG should be one of the dedicated backgrounds for diffs
+INTENSE-FG should be one of the dedicated foregrounds for diffs"
+ (list 'if 'modus-vivendi-theme-subtle-diffs
+ (list 'list :background subtle-bg :foreground subtle-fg)
+ (list 'list :background intense-bg :foreground intense-fg)))
+
;; Define colour palette. Each colour must have a >= 7:1 contrast
;; ratio relative to the foreground/background colour it is rendered
;; against.
@@ -1011,22 +1027,36 @@ between foreground and background is >= 7:1)."
`(diff-hl-insert ((,class (:inherit modus-theme-fringe-green))))
`(diff-hl-reverted-hunk-highlight ((,class (:inherit
modus-theme-intense-blue))))
;;;; diff-mode
- `(diff-added ((,class (:inherit modus-theme-diff-focus-added))))
- `(diff-changed ((,class (:inherit modus-theme-diff-focus-changed))))
+ `(diff-added ((,class ,(modus-vivendi-theme-diffs
+ bg-main green
+ bg-diff-focus-added fg-diff-focus-added))))
+ `(diff-changed ((,class ,(modus-vivendi-theme-diffs
+ bg-main yellow
+ bg-diff-focus-changed fg-diff-focus-changed))))
`(diff-context ((,class (:foreground ,fg-alt))))
`(diff-file-header ((,class (:foreground ,blue :weight bold))))
`(diff-function ((,class (:foreground ,fg-special-cold))))
`(diff-header ((,class (:foreground ,blue-nuanced))))
- `(diff-hunk-header ((,class (:inherit modus-theme-diff-heading :weight
bold))))
+ `(diff-hunk-header ((,class ,(modus-vivendi-theme-diffs
+ bg-alt blue-alt
+ bg-diff-heading fg-diff-heading))))
`(diff-index ((,class (:foreground ,blue-alt :weight bold))))
- `(diff-indicator-added ((,class (:inherit diff-added))))
- `(diff-indicator-changed ((,class (:inherit diff-changed))))
- `(diff-indicator-removed ((,class (:inherit diff-removed))))
- `(diff-nonexistent ((,class (:inherit modus-theme-intense-neutral :weight
bold))))
- `(diff-refine-added ((,class (:inherit modus-theme-diff-refine-added))))
- `(diff-refine-changed ((,class (:inherit modus-theme-diff-refine-changed))))
- `(diff-refine-removed ((,class (:inherit modus-theme-diff-refine-removed))))
- `(diff-removed ((,class (:inherit modus-theme-diff-focus-removed))))
+ `(diff-indicator-added ((,class (:inherit modus-theme-diff-focus-added))))
+ `(diff-indicator-changed ((,class (:inherit
modus-theme-diff-focus-changed))))
+ `(diff-indicator-removed ((,class (:inherit
modus-theme-diff-focus-removed))))
+ `(diff-nonexistent ((,class (:inherit modus-theme-neutral :weight bold))))
+ `(diff-refine-added ((,class ,(modus-vivendi-theme-diffs
+ bg-diff-added fg-diff-added
+ bg-diff-refine-added fg-diff-refine-added))))
+ `(diff-refine-changed ((,class ,(modus-vivendi-theme-diffs
+ bg-diff-changed fg-diff-changed
+ bg-diff-refine-changed fg-diff-refine-changed))))
+ `(diff-refine-removed ((,class ,(modus-vivendi-theme-diffs
+ bg-diff-removed fg-diff-removed
+ bg-diff-refine-removed fg-diff-refine-removed))))
+ `(diff-removed ((,class ,(modus-vivendi-theme-diffs
+ bg-main red
+ bg-diff-focus-removed fg-diff-focus-removed))))
;;;; dim-autoload
`(dim-autoload-cookie-line ((,class (:foreground ,fg-alt :slant
,modus-theme-slant))))
;;;; dired
@@ -1875,12 +1905,22 @@ between foreground and background is >= 7:1)."
`(magit-branch-upstream ((,class (:slant italic))))
`(magit-cherry-equivalent ((,class (:background ,bg-main :foreground
,magenta-intense))))
`(magit-cherry-unmatched ((,class (:background ,bg-main :foreground
,cyan-intense))))
- `(magit-diff-added ((,class (:inherit modus-theme-diff-added))))
- `(magit-diff-added-highlight ((,class (:inherit
modus-theme-diff-focus-added))))
- `(magit-diff-base ((,class (:inherit modus-theme-diff-changed))))
- `(magit-diff-base-highlight ((,class (:inherit
modus-theme-diff-focus-changed))))
+ `(magit-diff-added ((,class ,(modus-vivendi-theme-diffs
+ bg-main green
+ bg-diff-added fg-diff-added))))
+ `(magit-diff-added-highlight ((,class ,(modus-vivendi-theme-diffs
+ bg-dim green
+ bg-diff-focus-added
fg-diff-focus-added))))
+ `(magit-diff-base ((,class ,(modus-vivendi-theme-diffs
+ bg-main yellow
+ bg-diff-changed fg-diff-changed))))
+ `(magit-diff-base-highlight ((,class ,(modus-vivendi-theme-diffs
+ bg-dim yellow
+ bg-diff-focus-changed
fg-diff-focus-changed))))
`(magit-diff-context ((,class (:foreground ,fg-alt))))
- `(magit-diff-context-highlight ((,class (:background ,bg-inactive
:foreground ,fg-inactive))))
+ `(magit-diff-context-highlight ((,class ,(modus-vivendi-theme-diffs
+ bg-dim fg-dim
+ bg-inactive fg-inactive))))
`(magit-diff-file-heading ((,class (:foreground ,fg-special-cold :weight
bold))))
`(magit-diff-file-heading-highlight ((,class (:inherit
modus-theme-special-cold :weight bold))))
`(magit-diff-file-heading-selection ((,class (:background ,bg-alt
:foreground ,cyan))))
@@ -1890,8 +1930,12 @@ between foreground and background is >= 7:1)."
`(magit-diff-hunk-region ((,class (:weight bold))))
`(magit-diff-lines-boundary ((,class (:background ,fg-main))))
`(magit-diff-lines-heading ((,class (:inherit modus-theme-refine-magenta))))
- `(magit-diff-removed ((,class (:inherit modus-theme-diff-removed))))
- `(magit-diff-removed-highlight ((,class (:inherit
modus-theme-diff-focus-removed))))
+ `(magit-diff-removed ((,class ,(modus-vivendi-theme-diffs
+ bg-main red
+ bg-diff-focus-removed
fg-diff-focus-removed))))
+ `(magit-diff-removed-highlight ((,class ,(modus-vivendi-theme-diffs
+ bg-dim red
+ bg-diff-focus-removed
fg-diff-focus-removed))))
`(magit-diffstat-added ((,class (:foreground ,green))))
`(magit-diffstat-removed ((,class (:foreground ,red))))
`(magit-dimmed ((,class (:foreground ,fg-alt))))
- [elpa] externals/modus-vivendi-theme d3958bb 074/110: NEW CUSTOMISATION OPTION for "rainbow headings", (continued)
- [elpa] externals/modus-vivendi-theme d3958bb 074/110: NEW CUSTOMISATION OPTION for "rainbow headings", Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme e7a5f9a 077/110: NEW CUSTOMISATION OPTION for "section headings", Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme 4d7d769 020/110: Fix MAGIT regression on colours of unfocused diffs, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme d931e3c 022/110: Add docs on ORG colour-coded source blocks, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme 7fabd85 042/110: Add support for VIMISH-FOLD, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme 2c42b61 041/110: Add support for COLOR-RG, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme 53e1a43 046/110: Define new dedicated colours for language checkers, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme f8a4b1d 047/110: Refine FLYCHECK: use new dedicated linter colours, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme 272f7da 054/110: Style the `vertical-border' explicitly, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme d7b7252 056/110: Tweak border colour for Emacs 27 active tabs, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme 88489ed 014/110: New customisation option for SUBTLE DIFFS,
Stefan Monnier <=
- [elpa] externals/modus-vivendi-theme 43ebfb5 072/110: Modus Vivendi: tweak "magenta-alt", Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme c3c743b 075/110: Minor correction and clarification in the README, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme 0ffe48d 079/110: Update README with minor clarifications, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme 685c8c7 089/110: REMOVE table of contents: not working with GitLab, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme 3f4e09f 019/110: Add support for HELPFUL, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme 2f77706 021/110: Refine SELECTRUM faces (more faithful to original), Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme d32b2c8 024/110: Improve style of DIFF-HL "revert" command, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme 4de27df 025/110: Add support for SWOOP, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme 110a51f 026/110: Add support for SWITCH-WINDOW, Stefan Monnier, 2020/04/29
- [elpa] externals/modus-vivendi-theme 7b52738 039/110: Add support for HIGHLIGHT-SYMBOL, Stefan Monnier, 2020/04/29