emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Protesilaos Stavrou <info@protesilaos.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Review face for export dispatcher highlighted keys
Date: Mon, 12 Oct 2020 13:05:13 +0300	[thread overview]
Message-ID: <87blh7n4iu.fsf@protesilaos.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 872 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Review-face-for-export-dispatcher-highlighted-keys.patch --]
[-- Type: text/x-patch, Size: 2104 bytes --]

From 317eecf00b8c7d7112706b2438796f2aa4c48ecd Mon Sep 17 00:00:00 2001
From: Protesilaos Stavrou <info@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	other threads:[~2020-10-12 10:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-12 10:05 Protesilaos Stavrou [this message]
2020-10-24 11:45 ` [PATCH] Review face for export dispatcher highlighted keys Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blh7n4iu.fsf@protesilaos.com \
    --to=info@protesilaos.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).