Hi!
I am a happy user of the "deuteranopia style", purely per aesthetic
preference. One thing puzzles me, reading modus-themes--diff (the
function): IIUC, setting modus-themes-deuteranopia causes
modus-themes-diffs (the user option) to be ignored.
Is this by design, or is the composition of both options left as an
exercise to the reader?
I would expect these options to be orthogonal, i.e. a user with
red-green deficiency could still want to keep syntax highlighting (with
modus-themes-diffs set to 'bg-only) or to use less intense colors (with
'desaturated); however, I am very much ignorant on the topic of color
contrast, and on the effects of deuteranopia, so apologies if I am
missing something.
FWIW, I have added a couple of lines to my config to "patch up" Ediff
faces to remove the foreground color and tone down the backgrounds [1].
The code and the results are quite crude (especially with operandi), but
I find working with Ediff more pleasant this way: syntax highlighting is
still visible for "current" blocks, and with better contrast due to the
toned down backgrounds.
Since I have a workaround that works for me, my main motivation with
this email is curiosity: I'd like to know if modus-themes-deuteranopia
short-circuiting modus-themes-diffs is done on purpose, or if it's an
area of improvement.
(… Or if I'm completely wrong, both variables can already be composed
perfectly well, and this is all one big misunderstanding on my part 🙃)
Thanks for your time, and for all the wonderful work.
[1]
(defun my/modus-ediff-bg (face)
(require 'color)
(let ((old-bg (face-background face nil t)))
(if (equal (modus-themes--current-theme) 'modus-vivendi)
(color-darken-name old-bg 25)
(color-lighten-name old-bg 12))))
(defun my/modus-ediff-set-face (face)
(set-face-attribute
face nil
:inherit 'unspecified
:foreground 'unspecified
:background (my/modus-ediff-bg face)))
(defun my/modus-ediff-face-list ()
(require 'ediff-init)
(let ((kinds '("current" "fine"))
(targets '("A" "B" "C" "Ancestor")))
(mapcan
(lambda (target)
(mapcar
(lambda (kind)
(let ((face-name (format "ediff-%s-diff-%s" kind target)))
(or (intern-soft face-name)
(error "Cannot find face named %s" face-name))))
kinds))
targets)))
(defun my/modus-ediff ()
(mapc 'my/modus-ediff-set-face (my/modus-ediff-face-list)))
(add-hook 'modus-themes-after-load-theme-hook 'my/modus-ediff)
> From: Kévin Le Gouguec <kevin.legouguec@gmail.com>> Date: Sun, 22 May 2022 18:31:17 +0200>> Hi!
Hello Kevin!
> I am a happy user of the "deuteranopia style", purely per aesthetic> preference. One thing puzzles me, reading modus-themes--diff (the> function): IIUC, setting modus-themes-deuteranopia causes> modus-themes-diffs (the user option) to be ignored.>> Is this by design, or is the composition of both options left as an> exercise to the reader?
Yes, this is by design (maybe bad design, but design nonetheless). The
idea is that the user who sets up modus-themes-deuteranopia needs to
have the difference in colours that ensures legibility when accounting
for colour-blindness.
Put differently, I was thinking that the 'desaturated' and 'bg-only'
diffs would be too subtle for this purpose and, perhaps, not suitable
for users with red-green colour deficiency.
> I would expect these options to be orthogonal, i.e. a user with> red-green deficiency could still want to keep syntax highlighting (with> modus-themes-diffs set to 'bg-only) or to use less intense colors (with> 'desaturated); however, I am very much ignorant on the topic of color> contrast, and on the effects of deuteranopia, so apologies if I am> missing something.
We can make them orthogonal. I will give it a try now.
All the best,
Protesilaos (or simply "Prot")
--
Protesilaos Stavrou
https://protesilaos.com
> From: Protesilaos Stavrou <info@protesilaos.com>> Date: Mon, 23 May 2022 07:32:31 +0300>> We can make them orthogonal. I will give it a try now.
Just pushed the change in commit 11c701a. Please give it a try.
--
Protesilaos Stavrou
https://protesilaos.com
Protesilaos Stavrou <info@protesilaos.com> writes:
>> From: Kévin Le Gouguec <kevin.legouguec@gmail.com>>> Date: Sun, 22 May 2022 18:31:17 +0200>>>> Is this by design, or is the composition of both options left as an>> exercise to the reader?>> Yes, this is by design (maybe bad design, but design nonetheless). The> idea is that the user who sets up modus-themes-deuteranopia needs to> have the difference in colours that ensures legibility when accounting> for colour-blindness.>> Put differently, I was thinking that the 'desaturated' and 'bg-only'> diffs would be too subtle for this purpose and, perhaps, not suitable> for users with red-green colour deficiency.
Understood. Designing for color deficiency looks complex; I haven't
found a lot of measurable guidelines on the web, i.e. nothing as
clear-cut as WCAG criteria 1.4.3 and 1.4.6. "Understanding Success
Criterion 1.4.3" has a lot to say on the topic, though it does note that
color deficiencies are very diverse…
https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html>> I would expect these options to be orthogonal, i.e. a user with>> red-green deficiency could still want to keep syntax highlighting (with>> modus-themes-diffs set to 'bg-only) or to use less intense colors (with>> 'desaturated); however, I am very much ignorant on the topic of color>> contrast, and on the effects of deuteranopia, so apologies if I am>> missing something.>> We can make them orthogonal. I will give it a try now.
Thanks for considering the idea! I just pulled the main branch and gave
your commit a spin: it works great as far as I am concerned 🎉
FWIW though, I know I am very much not in the "target audience" for the
deuteranopia style, so if you ever find that this combination is
untenable (either because of low accessibility, or because it makes the
code too complex), feel free to ditch it.
Thanks a lot for your consideration!
> From: Kévin Le Gouguec <kevin.legouguec@gmail.com>> Date: Mon, 23 May 2022 08:18:16 +0200>> Understood. Designing for color deficiency looks complex; I haven't> found a lot of measurable guidelines on the web, i.e. nothing as> clear-cut as WCAG criteria 1.4.3 and 1.4.6. "Understanding Success> Criterion 1.4.3" has a lot to say on the topic, though it does note that> color deficiencies are very diverse…>> https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html
It is complex. For deuteranopia in particular, we already get most of
the work "for free" because (i) we have high contrast and (ii) most
colours we use are on the blue-cyan-magenta-purple side of the spectrum.
What remains then is to swap green for blue in every context where
colour-coding is in place.
>>> I would expect these options to be orthogonal, i.e. a user with>>> red-green deficiency could still want to keep syntax highlighting (with>>> modus-themes-diffs set to 'bg-only) or to use less intense colors (with>>> 'desaturated); however, I am very much ignorant on the topic of color>>> contrast, and on the effects of deuteranopia, so apologies if I am>>> missing something.>>>> We can make them orthogonal. I will give it a try now.>> Thanks for considering the idea! I just pulled the main branch and gave> your commit a spin: it works great as far as I am concerned 🎉
Very well! Pushed a minor follow-up tweak that is noticeable in
diff-mode.
> FWIW though, I know I am very much not in the "target audience" for the> deuteranopia style, so if you ever find that this combination is> untenable (either because of low accessibility, or because it makes the> code too complex), feel free to ditch it.
I think we are good here. Users can set modus-themes-diffs to nil.
Though I am open to make further tweaks and refinements.
> Thanks a lot for your consideration!
You are welcome! And thanks again for taking the time to start this
thread!
--
Protesilaos Stavrou
https://protesilaos.com