From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Use variable in setcustom Date: Thu, 14 Nov 2019 17:09:19 +0700 Message-ID: References: <20191110023036.r2gsq6znmykbol7q.ref@Ergus> <20191110023036.r2gsq6znmykbol7q@Ergus> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="189733"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Ergus via Users list for the GNU Emacs text editor To: Ergus Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 14 11:11:02 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iVC5e-000n9c-Gc for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Nov 2019 11:11:02 +0100 Original-Received: from localhost ([::1]:55358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVC5d-0007oV-BH for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Nov 2019 05:11:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43575) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVC4E-0006Az-35 for help-gnu-emacs@gnu.org; Thu, 14 Nov 2019 05:09:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iVC4C-0006UX-Rp for help-gnu-emacs@gnu.org; Thu, 14 Nov 2019 05:09:33 -0500 Original-Received: from mail-ua1-x930.google.com ([2607:f8b0:4864:20::930]:35706) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iVC4C-0006Tv-Nl for help-gnu-emacs@gnu.org; Thu, 14 Nov 2019 05:09:32 -0500 Original-Received: by mail-ua1-x930.google.com with SMTP id s14so1693853uad.2 for ; Thu, 14 Nov 2019 02:09:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=qbt5vpAQq57Ad72c0koYyg1DYliGGqxsWJGFPzV5kcU=; b=afULhxYYOETwpZpzG3kmEGqwISfgeU02tPTjewhrFTIJz2IZTtntnNBJoJQ8xamzuv CMZDGgMsm5k96coC5tF3/RYDQxLoJor6IgkehtyHcVinBYrHmS77ZaracmV/9i3tIGv1 +FLjjq7jCX9fm1Z7a5+C6zq3WbvscpozTw5dB7tWRJiWv4UznG+6w+8ul7XqvPEIgtid MNxC5lYXI87CKPEqvLS73PN0XKM87uIB+r37gXFXCrpbUtV+JpEGpIKJrw0DsG2xkcgz OZDF2F8/eHORDwxpF1M0XQ8BP2aucn2eGiGBQn0mBOiy0Jy4n6juzpgiEzdHzkCh83Bu kOBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=qbt5vpAQq57Ad72c0koYyg1DYliGGqxsWJGFPzV5kcU=; b=nVIiPes52nxonI23SPAicAe3DzCDCIcMCpQkEQPMkUx7kedaU/736aFdw1UHw5jc2O p5uYvQFtkzMEWjzECEkkwqBpIfb1IISoeR/jqmjZx0GYS6XWqk19uvb13VJA5x/KiNwE 9UlOUDQsVc5j/oUt9FEdZbRFHjKWQIovGhgKjZETrE3paF4cn/Z/u7eEp7k/sAqmMucn wIImAEmx8vEcUr7HADFvxpF4e+I5edD+v3pSruoTNPIhO8y/IZzSiBPA8toJ3FAYChgO TqAwuG8J+PVbW+ccKkZZ4IMtXP6wD3WuzZMTbA8Td9iGIX5qtz1rG9K9IijNNAXJOcBF uCiw== X-Gm-Message-State: APjAAAVv15Ju4xTMwSa86zgxijUTed19kkOdKAB6u51vI7pWKIka50ge b62U2y+b7u0NGmkQ1rsKxvCk+mWE63TqFQVHnUk= X-Google-Smtp-Source: APXvYqxzOmBs3bVBAowpSJOufgNq+baqMbz8Mih/I91t/Dy4BPoaIShirxrZaW5O4DJ+970RmsJ7TdyLambQwQzZzoE= X-Received: by 2002:ab0:254c:: with SMTP id l12mr5099798uan.79.1573726171743; Thu, 14 Nov 2019 02:09:31 -0800 (PST) In-Reply-To: <20191110023036.r2gsq6znmykbol7q@Ergus> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::930 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:121835 Archived-At: On Sun, 10 Nov 2019 at 09:31, Ergus wrote: > > Hi I want to have a simple colour palette that must be compatible with > tui and gui. The practical solution to that is to use a (stack of) terminal emulator(s) that supports 24-bit colors. > The problem is that the color names are not the same so for example the > brightblack are not available in gui only in tui. > > To work around this I made: > > ``` > (defconst my/colors '((black . "#000000") > (red . "#cd0000") > ... > (brightcyan . "#00ffff") > (brightwhite . "#ffffff")) > "List of colors.") > ``` > > And then I assign the colors with something like: > > ``` > (set-face-foreground 'font-lock-preprocessor-face (cdr (assq 'magenta > my/colors))) > ``` > > But if I try to use a better method for my colors as Stefan suggested: > > (custom-set-face ...) > > It doesn't work. Do we have some method to define colours or paletes? Custom themes. Which are arbitrary Elisp code and can thus define and use variables: (defconst yk-scarletred "#ef2929") (custom-theme-set-faces 'yk-dark-theme =E2=80=A6 `(yk-incorrect ((((type graphic)) . (:underline (:color ,yk-scarletred :style wave= ))) (((min-colors 16777216)) . (:foreground ,yk-scarletred :underline = t)))) `(trailing-whitespace ((default . (:inherit yk-incorrect)))) =E2=80=A6) (provide-theme 'yk-dark-theme) You can use anti-quoted variables or expressions with custom-set-face, too (I just think themes are cleaner): (custom-set-faces `(font-lock-preprocessor-face ((default :foreground ,(cdr (assq 'magenta my/colors))))))