From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= Newsgroups: gmane.emacs.help Subject: Re: Working with colors in --batch mode Date: Sun, 25 Dec 2022 19:49:19 +0100 Message-ID: <877cyfiaj4.fsf@gmail.com> References: <87fsd3id8e.fsf@gmail.com> <83pmc72wag.fsf@gnu.org> <83o7rr2vjk.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26705"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: help-gnu-emacs@gnu.org To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 25 19:49:57 2022 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 1p9W4K-0006k0-OY for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 25 Dec 2022 19:49:56 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9W3r-0001qL-NX; Sun, 25 Dec 2022 13:49:27 -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 1p9W3o-0001q3-Ok for help-gnu-emacs@gnu.org; Sun, 25 Dec 2022 13:49:26 -0500 Original-Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9W3h-0005bt-Bo; Sun, 25 Dec 2022 13:49:22 -0500 Original-Received: by mail-wr1-x42c.google.com with SMTP id a17so8666106wrt.11; Sun, 25 Dec 2022 10:49:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=GaiPGYZzuK0K2EE5Os8BltzMzdemR3J45EJZYJx0/Jk=; b=N+FH+odZ5vdLKPrSY+BGLTDkRtqoW57cNgqvfqypvWWn7xi8rBypYAdaB+rxKC0elD 8ruTryKS/aszi4+H4GiZALUTd95ZmWF3DDy4E9ovj3rKsIEH67eNMgtMqCNo+Fx32rtZ ENxaTgysset/oKSktwZEmaTyleu20dfYsByhv2PvzO29weIv93N90VsEH2zAXN+u4Isw w0AWDy8pQajQIvs831oykBgygCDW3jVuU479hYNg6D9r23OUni9ezUB1WlJcnGh4Aasv Xq3rgLNbtpymu/fiwUYE7YJYG1osGmTUEjl+tN3dfNI4ydBpzmzt/VtuQz+VCWR3bYyG 9GOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GaiPGYZzuK0K2EE5Os8BltzMzdemR3J45EJZYJx0/Jk=; b=MVzQLCsGzMiE8heJBlTphSz5t/JwWz7gj/7z8gf7zExSBalJZ2FGafcRXLK4NAFnIQ olFotXz4XvC4wnGkmxN3O8aSfFQ99juX3A507lojjIJ1BOtKT95Pn63Z/JrpFShS7Kmc uwpeOEFjeJBTQPAoQr+oDgjwES+3FX/GQSF52jrGMqvc/6M2UebVQRH4ZN3SArL6nr/o v/0SYzd/1pI9Q+51zBemKkHUQVpkT2rxBkphgalxNYbOnWi2zDDeiQW0rIK7fZSmoGTp I4ccY/zKhXMByNjryiVwNdsR9TwZx8dViPGqwnWCu5jxtn25XNY0n5j2OJWRdLP8KHPX XR5Q== X-Gm-Message-State: AFqh2kqN4Lk8yhsVZgIjjFdV5tVFBvljb5OczhiHxpabokwFSwMQhk7c IMdukNU82xlPXDLxME76XNtevVX3NWA= X-Google-Smtp-Source: AMrXdXvIbDfjkCfRXVf0wKmJFJ2AAPzK8zvmMlQdGVn9iXO+IbJyB+vOXJg1WeIvYvQBR9ukiI9Pkw== X-Received: by 2002:a5d:4561:0:b0:242:5927:2026 with SMTP id a1-20020a5d4561000000b0024259272026mr8739925wrc.40.1671994154790; Sun, 25 Dec 2022 10:49:14 -0800 (PST) Original-Received: from hirondell ([2a01:cb14:ac6:6a00:21c2:cad0:cb7c:24c0]) by smtp.gmail.com with ESMTPSA id p18-20020a056000019200b00279d23574c4sm3293997wrx.13.2022.12.25.10.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Dec 2022 10:49:14 -0800 (PST) In-Reply-To: <83o7rr2vjk.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 25 Dec 2022 20:22:07 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=kevin.legouguec@gmail.com; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:141939 Archived-At: Eli Zaretskii writes: >> Date: Sun, 25 Dec 2022 20:05:59 +0200 >> From: Eli Zaretskii >> >> Emacs doesn't (and cannot, I think) load X colors unless it >> initializes the X display, and that doesn't happen in batch sessions. >> Basically, batch sessions behave like a colorless TTY session. > > Btw, I don't really understand why you need the X machinery for this. > Doesn't tty-color-standard-values do the job? > > $ emacs -batch --eval "(message \"%s\" (tty-color-standard-values \"#abcdef\"))" > => (43947 52685 61423) Because this message is the latest step in a longer journey that started with me trying to call modus-themes-contrast in batch mode, as hinted in the OP. So I hope to find a solution that will let me keep calling this high-level function, instead of re-implementing it and its callees (e.g. color-name-to-rgb). Thanks for weighing in; it's not obvious to me yet that there's no way to ask emacs --batch to --eval its way into initializing the X display, but I may well end up reaching that conclusion after more digging.