emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] New function: color-blend


From: Joseph Turner
Subject: Re: [PATCH] New function: color-blend
Date: Sat, 09 Nov 2024 10:13:31 -0800

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Cc: emacs-devel@gnu.org
>> Date: Sat, 02 Nov 2024 11:00:46 -0700
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> >> 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 <yuri.v.khan@gmail.com>
>> > Subject: Re: [PATCH] New function: color-blend
>> > To: Joseph Turner <joseph@breatheoutbreathe.in>
>> > Cc: Emacs Devel Mailing List <emacs-devel@gnu.org>
>> > 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 <joseph@breatheoutbreathe.in> 
>> > 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...)

Thank you!  I see the changes you made, and I'll byte compile before
submitting patches next time.

Joseph



reply via email to

[Prev in Thread] Current Thread [Next in Thread]