From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Getting `load-theme` to work in `-batch` mode? Date: Wed, 14 Feb 2024 16:59:11 +0200 Message-ID: <86le7nxfb4.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27236"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Konstantin Kharlamov To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 14 15:59:48 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1raGjk-0006rd-0W for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 14 Feb 2024 15:59:48 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raGjJ-0008SZ-6M; Wed, 14 Feb 2024 09:59:21 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raGjE-0008O9-Cb for help-gnu-emacs@gnu.org; Wed, 14 Feb 2024 09:59:17 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raGjD-0004M8-AB; Wed, 14 Feb 2024 09:59:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=jhQ3OkpGM4ubnqYo36015q+Lub9zO8DB7o65nZHfypo=; b=CpXSL7fMLdnJWg67MxbU GNxvmsmohqSr37pV1ScKTu9FkoBDy6RZo9qK2xzsrPT0kyfnlTWsSzEUGi7V/DnQcT2dTPSZWUCeq 1iHQH42SJaS4A8GoLeuwsb09sQrNL/ONQPabntlZjQzxwsDQXpPWdlpO4s0l/GDCZQHTNsgD6NbDc k9QQ3OpCyqeDZjTPbrpckLOGY5N8VJfpZaT180v0URm8Afx52d5fVS5qXp5yXOg87HwQXa7HDxRrV nThcSupcpXCfgvQLf8u5+LV5lsw6ULGUmqqbkbhjNk9xDjeG0abpCqUnpzFCUR3IVXtrbv30lmU5v ZW1Kf1QbjE2C6Q==; In-Reply-To: (message from Konstantin Kharlamov on Tue, 13 Feb 2024 18:06:43 +0300) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:145940 Archived-At: > From: Konstantin Kharlamov > 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.