From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tyler Grinn Newsgroups: gmane.emacs.devel Subject: Re: Automatic face setting based on contrast? Date: Thu, 07 Oct 2021 08:32:01 -0400 Message-ID: <87tuhtrp6m.fsf@gmail.com> References: <87k0iub53g.fsf.ref@yahoo.com> <87k0iub53g.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33266"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux) Cc: luangruo@yahoo.com, Stefan Kangas , Richard Stallman , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Oct 07 14:36:55 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 1mYSdq-0008Tp-G4 for ged-emacs-devel@m.gmane-mx.org; Thu, 07 Oct 2021 14:36:54 +0200 Original-Received: from localhost ([::1]:59302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYSdp-0001Bi-JK for ged-emacs-devel@m.gmane-mx.org; Thu, 07 Oct 2021 08:36:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYSZC-0005OF-Ti for emacs-devel@gnu.org; Thu, 07 Oct 2021 08:32:06 -0400 Original-Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]:37686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mYSZB-0002HB-3e; Thu, 07 Oct 2021 08:32:06 -0400 Original-Received: by mail-qt1-x82c.google.com with SMTP id e16so5921298qts.4; Thu, 07 Oct 2021 05:32:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=5zQgKNfzC2HXt6zzsb8/QIlbb6DPYiio6DuJbzS5FYQ=; b=pMZpgszwq2MWcUGm9oxqiZthdcd8A4A7S1pipxYuQepjHiqV8vmznHseb68FFEaioB 2pTE/pZFXYvHK5c3rY5G04yyQPYrx8oAQdnqSOFBhSkYpi3jI/7SJ5BK4ohrAyIB8OtC nuYcRDs7v7r4r2tJLFYBEtrjuQbetFge7tlZj7Fx8URwHFHMi+PyTe6I5fI06yJ1F5J6 YX+2m12TKEcTb5YE90I0k/LuqDzhBljzCWKOorwTXR+fed7tiY50uwdFo7DFV9ZSUvko lEk+s3aUqKlJLmuPGJv2IoRWvqM0GqoLslNfu1wAJ7NBRq656g1Ex6sq2QbzttMj0/of 2NMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=5zQgKNfzC2HXt6zzsb8/QIlbb6DPYiio6DuJbzS5FYQ=; b=tgoUEJcG9hYIGI0eHfV0wLXc709TQHPb8nsKbaPbr2MTR+rFsGIZ873VtIIo6Dc8Ki ddclWASTMPbvO5XBqoCT59/Kf1opvx3BfZfEYaudp00o4LPTsshr+OwdogySBc72kiYM AHL+cPRwhK5RxOIPdNStbkxYcS9Vvt4AIAyFDtWzP/7SCCDNf3Yo1Depkd7Vebzua3th fXf5PQ/l6PzeOCPXDYh1FzruwmC01O9VyZoyPiIEP5iuLV7qXKHAR37cQOM2NtRpS39j g20thprbRDe+SyHxa8wZG4zpEbH3iCkZf5igVbxbfT9UO8hoMM5wMIJFtpJL7PSo/wFs HjuQ== X-Gm-Message-State: AOAM532c+BLYOTVRku95JrnPA8lSJ/5XVm+zDNZnYZWWvVByj/VbIsHt gmSySAuluWQpzrzNbI6Kzut0yGkNRzTB+Jk8 X-Google-Smtp-Source: ABdhPJwPcX8conKYe5lczlME0N01/DbyOnY+V9ghQuednBfiqodtFEGui1+gYI58DC/yVuT8ZjKeSA== X-Received: by 2002:ac8:4410:: with SMTP id j16mr4384756qtn.195.1633609922805; Thu, 07 Oct 2021 05:32:02 -0700 (PDT) Original-Received: from tyler-hp ([2601:410:4301:3e90::7c4]) by smtp.gmail.com with ESMTPSA id b17sm15048148qte.97.2021.10.07.05.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 05:32:02 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Tue, 05 Oct 2021 21:39:37 -0400") Received-SPF: pass client-ip=2607:f8b0:4864:20::82c; envelope-from=tylergrinn@gmail.com; helo=mail-qt1-x82c.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: 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:276491 Archived-At: Stefan Monnier writes: >> 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. > > We discussed such things in the past and yes, it would be great. > There are various situations, one of them being to compute faces when > a theme is installed or when a face is defined, but there can also be > more dynamic cases where a face could adapt to the place where it's used > (i.e. the actual computation would be performed during redisplay). > Not sure if those two situations should be treated uniformly or if they > should be handled by different mechanisms. > > > Stefan > > It seems to me that there will always be a choice to be made, or a range of acceptable colors for contrast. Maybe a less opinionated way to go about this would be to limit the color picker in the customize face buffer to accessible colors and show a warning for faces that are not sufficiently contrasting. One way to implement that would be to write a command to analyze all faces in the current buffer. That way, a theme author could enable a major mode and see a list of all faces and an accessibility report. -- Best, Tyler