unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Cc: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Subject: Re: Getting `load-theme` to work in `-batch` mode?
Date: Wed, 14 Feb 2024 16:59:11 +0200	[thread overview]
Message-ID: <86le7nxfb4.fsf@gnu.org> (raw)
In-Reply-To: <f662c74fdd53e76aac4ae1e82ec567138ce73849.camel@yandex.ru> (message from Konstantin Kharlamov on Tue, 13 Feb 2024 18:06:43 +0300)

> From: Konstantin Kharlamov <Hi-Angel@yandex.ru>
> Date: Tue, 13 Feb 2024 18:06:43 +0300
> 
> I'm writing tests for color-identifiers-mode, and as part of the
> testing I need to check it reacts correctly to theme being changed.
> 
> There are already tests that work fine so far, but it turns out `load-
> theme` doesn't work as is. More specifically, even though `(load-theme
> 'adwait)` works fine, but background/foreground have no color:
> 
>    emacs -batch --eval "(progn (load-theme 'adwaita) (print (face-
>    attribute 'default :foreground)) (print (face-attribute 'default
>    :background)))"
>    
>    "unspecified-fg"
>    
>    "unspecified-bg"

Those are the default colors of a text-mode frame.

> I asked on Emacs stackexchange¹ and I was hinted that it's because
> batch-mode doesn't initialize a windowing system.

That's right.

> But is there no function I can call to make `load-theme` assign colors
> as in non-batch mode?

What do you mean by that?  The GUI colors are not necessarily
supported by text-mode frames.  So what do you expect from the above?

Btw, if you look at adwaita-theme.el, you will see that it doesn't
bother supporting frames which support less than 89 colors, and the
default frame used by batch sessions certainly doesn't support such a
large number of colors.



  reply	other threads:[~2024-02-14 14:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 15:06 Getting `load-theme` to work in `-batch` mode? Konstantin Kharlamov
2024-02-14 14:59 ` Eli Zaretskii [this message]
2024-02-14 15:14   ` Konstantin Kharlamov
2024-02-14 15:34     ` Eli Zaretskii

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=86le7nxfb4.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=Hi-Angel@yandex.ru \
    --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).