emacs-devel
[Top][All Lists]
Advanced

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

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


From: Drew Adams
Subject: RE: [External] : Re: [PATCH] color-hsv-to-rgb
Date: Thu, 19 Oct 2023 20:12:47 +0000

> For what it's worth, I thought about adding this function too. I would
> use it for a custom theme to choose colors for 'vc-annotate'. My
> hypothetical code would take a starting color (in RGB), convert to HSV,
> and then increment the value component to produce gradually lighter
> colors. After that, I'd need a way to convert back to RGB to make the
> hex string for the face attribute, hence this new function.

Yes.  It should have been added long ago.

It's been available in hexrgb.el since 2005.

And hexrgb.el was offered to GNU Emacs.
And color.el was derived from hexrgb.el.

https://www.emacswiki.org/emacs/download/hexrgb.el

And you don't need to go to RGB to get
the hex RGB representation from HSV:

hexrgb-hsv-to-hex is a compiled Lisp function in ‘hexrgb.el’.

(hexrgb-hsv-to-hex HUE SATURATION VALUE &optional NB-DIGITS)

Return the hex RBG color string for inputs HUE, SATURATION, VALUE.
Those inputs are each in the range 0.0 to 1.0, inclusive.

Optional arg NB-DIGITS is the number of hex digits per component.  It
should be 1, 2, 3, or 4 (default: 4).

The output string is `#' followed by NB-DIGITS hex digits for each
color component.  So for the default NB-DIGITS value of 4, the form is
"#RRRRGGGGBBBB".

reply via email to

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