The export dispatcher's active keys are highlighted using the
'org-warning' face.  That face is applied in various contexts, including
the agenda.

Users who have difficulty reading the active keys of the export
dispatcher are therefore forced to modify 'org-warning' throughout their
setup, even though their problem is present only while viewing the
dispatch UI (because highlighted keys are one or a few characters long).

The attached patch is an attempt to address this issue by creating a new
face that is specifically designed for the dispatch UI.

For the background+foreground combinations, the selected values conform
with the highest accessibility standard for colour contrast (WCAG AAA,
else a minimum contrast ratio of 7:1).  I limited my options to what
'M-x list-colors-display' provides.

Best regards,
Protesilaos

-- 
Protesilaos Stavrou
protesilaos.com
>From 317eecf00b8c7d7112706b2438796f2aa4c48ecd Mon Sep 17 00:00:00 2001
From: Protesilaos Stavrou <i...@protesilaos.com>
Date: Mon, 12 Oct 2020 12:41:31 +0300
Subject: [PATCH] Review face for export dispatcher highlighted keys

* lisp/org-faces.el (org-dispatcher-highlight): Define new face.

* lisp/ox.el (org-export--dispatch-ui): Apply org-dispatcher-highlight
face.

The intent is to decouple the dispatcher's interface from the generic
org-warning face.  The dispatcher's active keys are thus made easier
to tell apart, without interfering with other applications of
org-warning.
---
 lisp/org-faces.el | 14 ++++++++++++++
 lisp/ox.el        |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index c0556b8bb..94b283ad6 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
@@ -45,6 +45,20 @@ The foreground color of this face should be equal to the background
 color of the frame."
   :group 'org-faces)
 
+(defface org-dispatcher-highlight
+  '((default :weight bold)
+    (((class color) (min-colors 88) (background dark))
+     :background "gray20" :foreground "gold1")
+    (((class color) (min-colors 88) (background light))
+     :background "SlateGray1" :foreground "DarkBlue")
+    (((class color) (min-colors 16) (background dark))
+     :foreground "yellow")
+    (((class color) (min-colors 16) (background light))
+     :foreground "blue")
+    (t :inverse-video t))
+  "Face for highlighted keys in the dispatcher."
+  :group 'org-faces)
+
 (defface org-level-1 '((t :inherit outline-1))
   "Face used for level 1 headlines."
   :group 'org-faces)
diff --git a/lisp/ox.el b/lisp/ox.el
index 6dd2cd4a0..5ffd66816 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -6706,7 +6706,7 @@ back to standard interface."
 	    ;; on the first key, if any.  A nil value means KEY will
 	    ;; only be activated at first level.
 	    (if (or (eq access-key t) (eq access-key first-key))
-		(propertize key 'face 'org-warning)
+		(propertize key 'face 'org-dispatcher-highlight)
 	      key)))
 	 (fontify-value
 	  (lambda (value)
-- 
2.28.0

Reply via email to