From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Simon Pugnet Newsgroups: gmane.emacs.devel Subject: Re: Automatic face setting based on contrast? Date: Thu, 07 Oct 2021 13:52:35 +0100 Message-ID: <87k0ipc7zg.fsf@polaris64.net> References: <87k0iub53g.fsf.ref@yahoo.com> <87k0iub53g.fsf@yahoo.com> <87tuhtrp6m.fsf@gmail.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="5280"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux) To: emacs-devel@gnu.org Cancel-Lock: sha1:IBWWi85BAufqwP/TmzIQ81k5ifg= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Oct 07 14:55:00 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 1mYSvF-0000rC-BN for ged-emacs-devel@m.gmane-mx.org; Thu, 07 Oct 2021 14:54:53 +0200 Original-Received: from localhost ([::1]:60080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYSvD-0004zp-HR for ged-emacs-devel@m.gmane-mx.org; Thu, 07 Oct 2021 08:54:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYStF-0001dD-9p for emacs-devel@gnu.org; Thu, 07 Oct 2021 08:52:49 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:34672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYStD-0000f2-Na for emacs-devel@gnu.org; Thu, 07 Oct 2021 08:52:49 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mYSt9-0008RN-UU for emacs-devel@gnu.org; Thu, 07 Oct 2021 14:52:43 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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:276493 Archived-At: Tyler Grinn writes: > Stefan Monnier writes: > >> 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. I remember reporting a bug with the color_distance function in xfaces.c and as I remember that led to a detailed and interesting discussion about how to calculate accurate colour distances. Here's the link to the thread in case it's useful: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41544 Simon