unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Joseph Turner <joseph@breatheoutbreathe.in>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] New function: color-blend
Date: Sat, 09 Nov 2024 12:46:48 +0200	[thread overview]
Message-ID: <86ikswn0pz.fsf@gnu.org> (raw)
In-Reply-To: <87a5ehldm9.fsf@breatheoutbreathe.in> (message from Joseph Turner on Sat, 02 Nov 2024 11:00:46 -0700)

> 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...)



  reply	other threads:[~2024-11-09 10:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-02  5:29 [PATCH] New function: color-blend Joseph Turner
2024-11-02  8:34 ` Eli Zaretskii
2024-11-02 18:00   ` Joseph Turner
2024-11-09 10:46     ` Eli Zaretskii [this message]
2024-11-09 18:13       ` Joseph Turner
2024-11-02 11:26 ` Yuri Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ikswn0pz.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joseph@breatheoutbreathe.in \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).