unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Working with colors in --batch mode
Date: Mon, 26 Dec 2022 18:40:54 +0100	[thread overview]
Message-ID: <87r0wmgj15.fsf@gmail.com> (raw)
In-Reply-To: <87fsd3id8e.fsf@gmail.com> ("Kévin Le Gouguec"'s message of "Sun, 25 Dec 2022 18:50:57 +0100")

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

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 #2: modus-diff-contrast.el --]
[-- Type: application/emacs-lisp, Size: 3287 bytes --]

[-- Attachment #3: modus-vivendi.png --]
[-- Type: image/png, Size: 59132 bytes --]

[-- Attachment #4: modus-vivendi-deuteranopia.png --]
[-- Type: image/png, Size: 60972 bytes --]

  parent reply	other threads:[~2022-12-26 17:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-25 17:50 Working with colors in --batch mode Kévin Le Gouguec
2022-12-25 18:05 ` Eli Zaretskii
2022-12-25 18:22   ` Eli Zaretskii
2022-12-25 18:49     ` Kévin Le Gouguec
2022-12-26 17:40 ` Kévin Le Gouguec [this message]
2022-12-26 22:57   ` Stefan Monnier via Users list for the GNU Emacs text editor

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87r0wmgj15.fsf@gmail.com \
    --to=kevin.legouguec@gmail.com \
    --cc=help-gnu-emacs@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.
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).