From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] New function: color-blend Date: Sat, 09 Nov 2024 12:46:48 +0200 Message-ID: <86ikswn0pz.fsf@gnu.org> References: <87wmhmgq4a.fsf@breatheoutbreathe.in> <86o72yyqxa.fsf@gnu.org> <87a5ehldm9.fsf@breatheoutbreathe.in> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11586"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Joseph Turner Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 09 11:47:39 2024 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 1t9j0E-0002ql-Lx for ged-emacs-devel@m.gmane-mx.org; Sat, 09 Nov 2024 11:47:38 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t9izb-0006LB-Hz; Sat, 09 Nov 2024 05:46:59 -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 1t9izV-0006Km-Mh for emacs-devel@gnu.org; Sat, 09 Nov 2024 05:46:57 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t9izT-00035Y-WB; Sat, 09 Nov 2024 05:46:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=U/azZN1Dz9DhZ6/4bA05fscPFLqIboV8wuugddjPPW4=; b=UOa2ZJ3gAhXBhr2rqPYG oF+rGp8h8uight5u9h30fV5S748rNs0MUak4iZ5bNKGepYogGNPJZM+ZoC1FYANZKZyxHMNBBoISm OOoix0AcqRIMVneT9/PLP/byB/CQqOfAdYXOnQ17yH4GhOXuPEXLJtVYE+HoMHJgTcw+DCWjqi16/ 5Rgw4yYLlP0rzhruwIy8lvZjeFUVj6QjXSGpwZWwt/c/Btl2WOComO0YK1h/MWGAgaT9Lxz293nlV LfoDr/9K5M0uvpnh27xkKsU6wZClGyiZPZEyGTF75Rz74z7xfM06ZH5r4lEBLReMstkGHScH9RAts 9wj53345/DU3FA==; In-Reply-To: <87a5ehldm9.fsf@breatheoutbreathe.in> (message from Joseph Turner on Sat, 02 Nov 2024 11:00:46 -0700) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:325327 Archived-At: > From: Joseph Turner > Cc: emacs-devel@gnu.org > Date: Sat, 02 Nov 2024 11:00:46 -0700 > > Eli Zaretskii writes: > > >> From: Joseph Turner > >> Date: Fri, 01 Nov 2024 22:29:41 -0700 > >> > >> Here's `color-blend', a function to blend two colors into one. The > >> patchset also replaces `vtable--color-blend' with `color-blend'. > >> > >> Examples of this function being implemented separately in the wild: > >> > >> https://github.com/alphapapa/prism.el/blob/2fa8eb5a9ca62a548d33befef4517e5d0266eb28/prism.el#L1044 > >> https://oremacs.com/2015/04/28/blending-faces/ > > > > Thanks. > > > >> +--- > >> +** New function 'color-blend'. > >> +This function blends two RGB lists into one. > > > > This should explain what the function does, in terms that are clear > > even to those who are not experts in this area. AFAIU, "color > > blending" has at least two different meanings. > > > >> +(defun color-blend (a b &optional alpha) > >> + "Blend the two colors A and B with ALPHA. > >> +A and B should be lists (RED GREEN BLUE), where each element is > >> +between 0.0 and 1.0, inclusive. ALPHA controls the influence A > >> +has on the result and should be between 0.0 and 1.0, inclusive." > > > > The doc string should document the return value. Perhaps an example > > of blending will also be a good addition to the doc string. > > > From: Yuri Khan > > Subject: Re: [PATCH] New function: color-blend > > To: Joseph Turner > > Cc: Emacs Devel Mailing List > > Date: Sat, 2 Nov 2024 18:26:57 +0700 (6 hours, 32 minutes, 20 seconds ago) > > Flags: seen, personal > > Maildir: /joseph-breatheoutbreathein/INBOX > > > On Sat, 2 Nov 2024 at 14:03, Joseph Turner wrote: > > > > Here's `color-blend', a function to blend two colors into one. > > > It would be nice to explicitly mention linear RGB space. Most > > users[citation needed] these days are accustomed to colors specified > > in sRGB space and naïve conversion dividing by 255 will not give the > > desired blends. As an example, linear mixing black (0 0 0) with white > > (1 1 1) yields (0.5 0.5 0.5). Naïve scaling will yield #808080 whereas > > middle gray is somewhere around #bebebe in sRGB. > > Thanks for the feedback! Please see the attached revised patch. Thanks, installed on master. (I needed a few followup changes, as it looks like you ignored byte-compilation warnings...)