help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Working with colors in --batch mode


From: Kévin Le Gouguec
Subject: Re: Working with colors in --batch mode
Date: Mon, 26 Dec 2022 18:40:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Kévin Le Gouguec <kevin.legouguec@gmail.com> writes:

> I'm guessing it's just a matter of finding x such that…
>
> $ emacs --batch \
>     --eval "$x" \
>     --eval '(message "color-name-to-rgb: %s"
>                      (color-name-to-rgb "#abcdef"))'
>
> … sets up enough "graphical terminal" support that display-graphic-p
> holds, and (color-values "#abcdef") returns (43947 52685 61423) instead
> of (0 65535 65535), but x eludes me thus far.

Meh.  --batch sets noninteractive; from there,
src/dispnew.c:init_display completely avoids init_display_interactive,
so initial-window-system remains nil, which AFAICT tells lisp/startup.el
to skip a bunch of window-system initialization (such as, well,
lisp/term/x-win.el:window-system-initialization).

I crammed a sizable portion of startup.el into --eval, but never got
past the "I/O possible" signal I mentioned.  Ah well.

(Past-last-minute thought: hey, maybe I should see what function
installs the handler for that signal, and see if I can reach it from
--eval…  Oh well)

> Alternatively, I could drop --batch and switch to princ +
> external-debugging-output + kill-emacs, I guess.

Going with that 🤷

$ emacs \
    --eval "(princ (format \"color-name-to-rgb: %s\\n\"
                     (color-name-to-rgb \"#abcdef\"))
                   'external-debugging-output)" \
    -f kill-emacs
color-name-to-rgb: (0.6705882352941176 0.803921568627451 0.9372549019607843)

                                   ⁂
                                ℰ𝓅𝒾𝓁ℴℊ𝓊ℯ
                                   ⁂

Some closure for whoever took the time to read this.

Here's what I initially set out to do: review the contrast of diff faces
from the Modus themes v4 (in-progress), and flag those where the ratio
dips below 7:1.

With $PWD at the root of the Modus themes repo, on branch version-4, and
the attached modus-diff-contrast.el checked out:

<https://git.sr.ht/~protesilaos/modus-themes/tree/version-4>

$ emacs -Q -L . -l modus-themes                   \
        -l modus-diff-contrast.el                 \
        -f kill-emacs

Sample screenshots attached; personal takeaways:

* refinements really are somewhat hard to see (especially source code
  comments in Ediff); bummer, since they are supposed to help words pop
  out within a line,

* the dark deuteranopia theme has poorer contrast than the "vanilla"
  dark theme, on average.

Now to decide whether it's worth pestering Prot about this, or if I
should just use v4's new knobs to make vivendi-deuteranopia backgrounds
darker 🤔


Again, jolly good times to you all.


Attachment: modus-diff-contrast.el
Description: application/emacs-lisp

Attachment: modus-vivendi.png
Description: PNG image

Attachment: modus-vivendi-deuteranopia.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]