From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.devel Subject: Re: Automatic face setting based on contrast? Date: Tue, 5 Oct 2021 19:10:48 -0400 Message-ID: References: <87k0iub53g.fsf.ref@yahoo.com> <87k0iub53g.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2769"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, Protesilaos Stavrou , emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 06 01:11:53 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mXtbF-0000Qk-2k for ged-emacs-devel@m.gmane-mx.org; Wed, 06 Oct 2021 01:11:53 +0200 Original-Received: from localhost ([::1]:48876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXtbD-0006xt-D7 for ged-emacs-devel@m.gmane-mx.org; Tue, 05 Oct 2021 19:11:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXtaH-0006C3-29 for emacs-devel@gnu.org; Tue, 05 Oct 2021 19:10:53 -0400 Original-Received: from mail-pf1-f170.google.com ([209.85.210.170]:44881) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mXtaF-0003Zt-JE; Tue, 05 Oct 2021 19:10:52 -0400 Original-Received: by mail-pf1-f170.google.com with SMTP id 145so754094pfz.11; Tue, 05 Oct 2021 16:10:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc; bh=Aw60NfXSxS7poJDU0fv+oBzD7cjbU3XzK0Pm76yVxHk=; b=1QrIjO0y1jdH72ZIY8qRu8vcxOD3uxW21o0eVU/A1XOF0NxQm/JjplkBZKjCbhxx30 MDFSI6YgQJUz2ElXUrFbF3d1hfGEkYNbWbkcinecahn5X68ybc/6XfdrtpjZ7vQWkYjl mHmcE3NQzRsuE8aXcgbuZuQBaRAaV9HNke+FACucctZT1KIXqGZ0ZGEHP6q4Q2nxkRfb /HNtiro4XF47tG/LbDZMjF2sRN3DWsaBsABxyXtpU55D4EXzMRfJQQwPB03Gyey5cFr/ D0gK1b3GrSk3z1xdxH1uAuFUwlss6MYIt8gPInjLHWgGEOJgyXYByF1I/maG6SAcKI4D cLvg== X-Gm-Message-State: AOAM533RG+bXC79omqt0LGgBiugJzOEjvtJW31PKace5iBQHUEqWKRjs 5K8HLio6FfaLusECkb52qcHDMiIvXfbtwBSQ7QB75pGs X-Google-Smtp-Source: ABdhPJyHE9taZBGdrrPazuB2tA9lfxs0hQkNgm1Ot9+ExN/dcyuVyf9ARsd+CdrRl7rMF/a9vwyH5Q5HtayTsQK4X1E= X-Received: by 2002:a62:cd0f:0:b0:447:b8fe:d6c2 with SMTP id o15-20020a62cd0f000000b00447b8fed6c2mr33846542pfg.70.1633475449494; Tue, 05 Oct 2021 16:10:49 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 5 Oct 2021 19:10:48 -0400 In-Reply-To: Received-SPF: pass client-ip=209.85.210.170; envelope-from=stefankangas@gmail.com; helo=mail-pf1-f170.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:276400 Archived-At: Richard Stallman writes: > > I made this point in the above bug report, but there is no way to > > style Emacs with 25-50 face definitions. It is very hard to put an > > exact number on this, as e.g. some faces are inherited and therefore > > more important, but realistically speaking you need at least twice > > that to have a somewhat decent coverage. > > Is this something that could be fixed, in principle? Could a theme > specify some faces manually, and then Emacs would adjust various other > faces automatically so as to contrast with some of those? > > Currently, a face can inherit properties from another face. > Could there be a kind of contrast-inheritance where face A > is set automatically to contrast strongly with B, and contrast > somewhat with C and D? Based on calculations on the RGB codes, > I imagine. > > This would call for a bit of research, but if we got it to work, > specifying a good theme might become a lot easier. I think it would be hard to find something "perfect", but if the goal is to get something "good enough" or even just "a bit better", then it sounds more achievable. solarized themes has an interesting concept, where you only need to specify a few base colors that the rest of the theme is calculated from. So here's a theme definition: ;; inspired vim's jellybeans color-theme (solarized-create-theme-file-with-palette 'light 'solarized-jellybeans-light '("#202020" "#ffffff" "#ffb964" "#8fbfdc" "#a04040" "#b05080" "#805090" "#fad08a" "#99ad6a" "#8fbfdc")) You can also override individual faces in case the algorithm fails. I have no idea how well suited this approach is for general use, but I suspect that you end up with a theme that fits within very specific parameters. Another idea is semantic faces. For example, instead of just having the face `info-title-1', we would have a general face `title1' that a face in a mode that implements headlines would inherit from. We obviously already have some semantic faces, like `font-lock-doc-face', but the concept could perhaps be developed.