branch: elpa/cider
commit f97f8710a091062086d5e405e00ebb59b001396e
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>

    Default the nREPL message palette to distinct hues, not font-lock faces
    
    The message faces exist only to tell one exchange from the next, so 
inheriting
    semantic font-lock faces was misleading (e.g. a normal exchange rendered in
    `font-lock-warning-face') and collapsed into weight/slant differences on 
themes
    that don't distinguish font-lock by color.  Default them to eight distinct
    hues instead, each with a light- and dark-background variant.  They stay 
faces,
    so they remain fully customizable and theme-remappable.
---
 CHANGELOG.md         |  2 +-
 lisp/nrepl-client.el | 45 +++++++++++++++++++++++++++++++++++----------
 2 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 98a4908d24..5190138f9a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -87,7 +87,7 @@
 - Rename `cider-log-buffer-clear-p` to `cider-log-buffer-has-content-p` - the 
old name read as the opposite of its behavior; it remains as an obsolete alias.
 - Bump the default `cider-repl-history-size` from 500 to 5000.
 - Rename the REPL history browser from `cider-repl-history` to `cider-history` 
(command, mode and options), so its names no longer clash with the REPL's 
unrelated input-history settings (`cider-repl-history-file`, 
`cider-repl-history-size`); the old names keep working as obsolete aliases.
-- Color the nREPL messages buffer with theme-aware faces 
(`nrepl-message-faces`, eight faces inheriting from standard font-lock faces) 
instead of a hardcoded color list; `nrepl-message-colors` is now obsolete, but 
still takes precedence when customized.
+- Color the nREPL messages buffer with customizable faces 
(`nrepl-message-faces`, a palette of eight distinct hues with light- and 
dark-background variants) instead of a hardcoded color list; 
`nrepl-message-colors` is now obsolete, but still takes precedence when 
customized.
 - Consolidate the per-buffer auto-select options into a single 
`cider-auto-select-buffer`, which can be `t`, `nil` or a list of the popup 
buffers to select (e.g. `'(error inspector)`); the old options 
(`cider-auto-select-error-buffer`, `cider-auto-select-test-report-buffer`, 
`cider-doc-auto-select-buffer`, `cider-inspector-auto-select-buffer`, 
`cider-cheatsheet-auto-select-buffer` and 
`cider-log-auto-select-frameworks-buffer`) are now obsolete, but still take 
precedence when customized.
 - [#4059](https://github.com/clojure-emacs/cider/pull/4059): Use the public 
`sesman-sessions` (via `cider-sessions`) instead of a private sesman function 
in `cider-debug-sesman-friendly-session-p` 
([#4037](https://github.com/clojure-emacs/cider/issues/4037)).
 - [#4056](https://github.com/clojure-emacs/cider/pull/4056): Show the 
interactive-evaluation spinner in the buffer you evaluated from (the source 
buffer, or the REPL when evaluating at its prompt) instead of always in the 
REPL buffer, which is often not even visible 
([#3516](https://github.com/clojure-emacs/cider/issues/3516)).
diff --git a/lisp/nrepl-client.el b/lisp/nrepl-client.el
index f14524748d..b2a2828bb6 100644
--- a/lisp/nrepl-client.el
+++ b/lisp/nrepl-client.el
@@ -1440,35 +1440,59 @@ error pointing at `nrepl-toggle-message-logging'."
                             (mapcar #'buffer-name buffers)
                             nil t)))))))
 
-(defface nrepl-message-1-face '((t :inherit font-lock-keyword-face))
+;; The colors below are a qualitative palette: their only job is to tell one
+;; message exchange from the next, so they default to eight distinct hues
+;; rather than inheriting semantic font-lock faces (which would imply meaning
+;; that isn't there, and would collapse into weight/slant differences on themes
+;; that don't distinguish font-lock by color).  Each hue has a darker variant
+;; for light backgrounds and a brighter one for dark backgrounds; remap or
+;; customize the faces to taste.
+
+(defface nrepl-message-1-face
+  '((((background light)) :foreground "#2166ac")
+    (t :foreground "#6cb6ff"))
   "Face 1 of the palette cycled through when coloring nREPL messages."
   :package-version '(cider . "2.0.0"))
 
-(defface nrepl-message-2-face '((t :inherit font-lock-string-face))
+(defface nrepl-message-2-face
+  '((((background light)) :foreground "#b35900")
+    (t :foreground "#e8a15a"))
   "Face 2 of the palette cycled through when coloring nREPL messages."
   :package-version '(cider . "2.0.0"))
 
-(defface nrepl-message-3-face '((t :inherit font-lock-function-name-face))
+(defface nrepl-message-3-face
+  '((((background light)) :foreground "#237a23")
+    (t :foreground "#89c559"))
   "Face 3 of the palette cycled through when coloring nREPL messages."
   :package-version '(cider . "2.0.0"))
 
-(defface nrepl-message-4-face '((t :inherit font-lock-variable-name-face))
+(defface nrepl-message-4-face
+  '((((background light)) :foreground "#a3187a")
+    (t :foreground "#f57ac8"))
   "Face 4 of the palette cycled through when coloring nREPL messages."
   :package-version '(cider . "2.0.0"))
 
-(defface nrepl-message-5-face '((t :inherit font-lock-type-face))
+(defface nrepl-message-5-face
+  '((((background light)) :foreground "#00808b")
+    (t :foreground "#4fcfc4"))
   "Face 5 of the palette cycled through when coloring nREPL messages."
   :package-version '(cider . "2.0.0"))
 
-(defface nrepl-message-6-face '((t :inherit font-lock-constant-face))
+(defface nrepl-message-6-face
+  '((((background light)) :foreground "#c62828")
+    (t :foreground "#ff6e6e"))
   "Face 6 of the palette cycled through when coloring nREPL messages."
   :package-version '(cider . "2.0.0"))
 
-(defface nrepl-message-7-face '((t :inherit font-lock-builtin-face))
+(defface nrepl-message-7-face
+  '((((background light)) :foreground "#7b2fa3")
+    (t :foreground "#c58af0"))
   "Face 7 of the palette cycled through when coloring nREPL messages."
   :package-version '(cider . "2.0.0"))
 
-(defface nrepl-message-8-face '((t :inherit font-lock-warning-face))
+(defface nrepl-message-8-face
+  '((((background light)) :foreground "#8a6d00")
+    (t :foreground "#d4b24a"))
   "Face 8 of the palette cycled through when coloring nREPL messages."
   :package-version '(cider . "2.0.0"))
 
@@ -1478,8 +1502,9 @@ error pointing at `nrepl-toggle-message-logging'."
     nrepl-message-7-face nrepl-message-8-face)
   "Faces cycled through when coloring the messages buffer.
 Each message is assigned a face based on its id, so the requests and
-responses belonging to the same exchange share a color.  The defaults
-inherit from standard font-lock faces, so they follow your theme."
+responses belonging to the same exchange share a color.  The defaults are a
+palette of eight distinct hues (with light- and dark-background variants) so
+that adjacent exchanges stay easy to tell apart on any theme."
   :type '(repeat face)
   :package-version '(cider . "2.0.0"))
 

Reply via email to