From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dov Grobgeld Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] color-hsv-to-rgb Date: Tue, 17 Oct 2023 09:12:05 +0300 Message-ID: References: <83y1g2ojrl.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000aa53590607e367e1" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23434"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 17 08:13:49 2023 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 1qsdKu-0005tb-Pb for ged-emacs-devel@m.gmane-mx.org; Tue, 17 Oct 2023 08:13:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsdJZ-00089q-QY; Tue, 17 Oct 2023 02:12:25 -0400 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 1qsdJY-000891-5v for emacs-devel@gnu.org; Tue, 17 Oct 2023 02:12:24 -0400 Original-Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsdJW-0003il-6w; Tue, 17 Oct 2023 02:12:23 -0400 Original-Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-50799fe3422so1002793e87.1; Mon, 16 Oct 2023 23:12:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697523139; x=1698127939; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=NqTThrUaqONQn7g9uTnuX4nO3eoI2SJjynr3HCzW/w0=; b=CTRWZx92kxO4MQKXSEeRFb5f6Xk0MRJVY90nj1RXJlXiEb8nbNhsBJ5G7AIFpT6cs1 7qZnIRcyvbZfxUH07zwHzza4/s+aiq1fyhZmrrVY2jZf+7S7vTKGVmZVSRF5JRtyjiMj Swdzge0778cfrOkz5Lb+FlgssBaEs1YJwHPAl0jLbGhUWJh6o5mpWUqhe/RoY8duyHVO U1b9/V1Y74Qz9MY1uk4fOiKWz6bcYi+7v4KmAGbDIskorSW6KZEGiW7D/jRkgMWR9CNt hiGSj72VYDebRmJN4W5ChJE9zqpB0+nklEx6lTxs6V6pgtqwB5JTirQF7p1Ybe6WaLJm NwVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697523139; x=1698127939; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NqTThrUaqONQn7g9uTnuX4nO3eoI2SJjynr3HCzW/w0=; b=j7zlI+s0HkePF8bMDKncvEkrooNMGifQXkjDWHVOXbizgm/kd7WMN1xucDFUwXTl1l QMW+oK9GgN6E0OYbOeeABP4ZMChwhGAbQrVhcf5x+/8eLgRkyRA5gqKxzOniHyLZJQnn 45FOUtHqjtaK7FiIzDY8F5bhFY7Z3v3MZZds/595PTfT9ForMcw8DIF4wwmfTzEeQTcw ErVoVE4TrSWzC7l3jwUO8uXZOO0VmOA/lOph5L7r83UM5iKBtVqK/qMnyFcb0U978Whw beVN7fzZdFe0VlxQpRwewrx2U9+nrvHuofjNfZ+Pa32XyivZZC23x0j4NJqHVjNqZGSE lt+w== X-Gm-Message-State: AOJu0YyJ0OAEBP4nide0yiAEVeN4dNlMD5Nyo2xmMQAtJofpRPDAY2iy q1SRZQETa18ieyRZJTzwzPoUOYl4vB0E7E25NNJQq2CR+aw= X-Google-Smtp-Source: AGHT+IFXDZLOkCtIVslwKiwi7mNXZBc2x6t4QEDBa1LG5GNrBLHRTMi3XHsP2rjAxMYa/o3Tpe9DSgnXOjFe4GsNkf0= X-Received: by 2002:a05:6512:2256:b0:507:99a1:406c with SMTP id i22-20020a056512225600b0050799a1406cmr861458lfu.4.1697523138448; Mon, 16 Oct 2023 23:12:18 -0700 (PDT) In-Reply-To: <83y1g2ojrl.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::135; envelope-from=dov.grobgeld@gmail.com; helo=mail-lf1-x135.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, HTML_MESSAGE=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.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:311530 Archived-At: --000000000000aa53590607e367e1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks Eli and Stefan, I'm working on the copyright assignment. Regarding Stefan's question about the use case for hsv-to-rgb. I was playing around with https://github.com/jdtsmith and I got the idea that it would be nice to have the color change its hue as a function of the indentation level. And I also wanted the saturation to change for the current indentation level. Since I'm using a bright background, this gets easy in HSV space. So that's the back story. Regards and with hope for better times, On Mon, Oct 16, 2023 at 3:05=E2=80=AFPM Eli Zaretskii wrote: > > From: Dov Grobgeld > > Date: Mon, 16 Oct 2023 10:28:44 +0300 > > > > I would like to do my first(!) contribution to emacs with the attached > patch. Is there interest, or is it too > > trivial? Do I need to do a copyright assignment? Is there a guide for > dummies on how to do that? > > Thanks, see Stefan's response for some of the answers. > > > diff --git a/lisp/color.el b/lisp/color.el > > index f68cf5e6b17..37f11f23c7c 100644 > > --- a/lisp/color.el > > +++ b/lisp/color.el > > This needs a ChangeLog-style commit log message (see CONTRIBUTE for > our expectations and "git log" for examples). > > > +(defun color-hsv-to-rgb (H S V) > > + "Convert hue, saturation and value to their RGB representation. > > +H, S, and V should each be numbers between 0.0 and 1.0, inclusive. > > Our conventions is to mention the argument names on the first line > > > +Return a list (RED GREEN BLUE), where each element is between 0.0 and > 1.0, > > +inclusive." > > + (let* ((I (floor (* 6 H))) > > + (F (- (* H 6) I)) > > + (P (* V (- 1.0 S))) > > + (Q (* V (- 1.0 (* F S)))) > > + (T (* V (- 1.0 (* (- 1.0 F) S)))) > > + (I (mod I 6))) > > + (cond > > + ((=3D I 0) (list V T P)) > > + ((=3D I 1) (list Q V P)) > > + ((=3D I 2) (list P V T)) > > + ((=3D I 3) (list P Q V)) > > + ((=3D I 4) (list T P V)) > > + ((=3D I 5) (list V P Q)) > > + (t (list 0 0 0))))) > > + > > Would you mind adding tests for this function to > test/lisp/color-tests.el? > > Thanks. > --000000000000aa53590607e367e1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks Eli and Stefan,

I'm wor= king on the copyright assignment.

Regarding Stefan&#= 39;s question about the use case for hsv-to-rgb. I was playing around with = https://github.com/jdtsmith and= I got the idea that it would be nice to have the color change its hue as a= function of the indentation level. And I also wanted the saturation to cha= nge for the current indentation level. Since I'm using a bright backgro= und, this gets easy in HSV space. So that's the back story.
Regards and with hope for better times,

On Mon, Oct 16, = 2023 at 3:05=E2=80=AFPM Eli Zaretskii <e= liz@gnu.org> wrote:
> From: Dov Grobgeld <dov.grobgeld@gmail.com>
> Date: Mon, 16 Oct 2023 10:28:44 +0300
>
> I would like to do my first(!) contribution to emacs with the attached= patch. Is there interest, or is it too
> trivial? Do I need to do a copyright assignment? Is there a guide for = dummies on how to do that?

Thanks, see Stefan's response for some of the answers.

> diff --git a/lisp/color.el b/lisp/color.el
> index f68cf5e6b17..37f11f23c7c 100644
> --- a/lisp/color.el
> +++ b/lisp/color.el

This needs a ChangeLog-style commit log message (see CONTRIBUTE for
our expectations and "git log" for examples).

> +(defun color-hsv-to-rgb (H S V)
> +=C2=A0 "Convert hue, saturation and value to their RGB represent= ation.
> +H, S, and V should each be numbers between 0.0 and 1.0, inclusive.
Our conventions is to mention the argument names on the first line

> +Return a list (RED GREEN BLUE), where each element is between 0.0 and= 1.0,
> +inclusive."
> +=C2=A0 (let* ((I (floor (* 6 H)))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(F (- (* H 6) I))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(P (* V (- 1.0 S)))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(Q (* V (- 1.0 (* F S))))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(T (* V (- 1.0 (* (- 1.0 F) S)))) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(I (mod I 6)))
> +=C2=A0 =C2=A0 (cond
> +=C2=A0 =C2=A0 =C2=A0((=3D I 0) (list V T P))
> +=C2=A0 =C2=A0 =C2=A0((=3D I 1) (list Q V P))
> +=C2=A0 =C2=A0 =C2=A0((=3D I 2) (list P V T))
> +=C2=A0 =C2=A0 =C2=A0((=3D I 3) (list P Q V))
> +=C2=A0 =C2=A0 =C2=A0((=3D I 4) (list T P V))
> +=C2=A0 =C2=A0 =C2=A0((=3D I 5) (list V P Q))
> +=C2=A0 =C2=A0 =C2=A0(t (list 0 0 0)))))
> +

Would you mind adding tests for this function to
test/lisp/color-tests.el?

Thanks.
--000000000000aa53590607e367e1--