emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] color-hsv-to-rgb


From: Eli Zaretskii
Subject: Re: [PATCH] color-hsv-to-rgb
Date: Mon, 16 Oct 2023 15:05:02 +0300

> 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)
> +  "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
> +     ((= I 0) (list V T P))
> +     ((= I 1) (list Q V P))
> +     ((= I 2) (list P V T))
> +     ((= I 3) (list P Q V))
> +     ((= I 4) (list T P V))
> +     ((= 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.



reply via email to

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