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

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

Re: Getting `load-theme` to work in `-batch` mode?


From: Eli Zaretskii
Subject: Re: Getting `load-theme` to work in `-batch` mode?
Date: Wed, 14 Feb 2024 16:59:11 +0200

> 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 via email to

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