[Top][All Lists]

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

Re: color-rgb-to-hex rounding / color-srgb-to-xyz typos

From: Thomas Frössman
Subject: Re: color-rgb-to-hex rounding / color-srgb-to-xyz typos
Date: Wed, 20 Jan 2021 16:17:31 +0100

On Tue, Jan 19, 2021 at 4:37 AM Lars Ingebrigtsen <larsi@gnus.org> wrote:
Thomas Frössman <thomasf@jossystem.se> writes:

> 1. color-rgb-to-hex rounding
> Hi. I was investigating why a simple color space conversion from rgb
> to lab and back via just multiplying a component with 1.0 caused
> colors to change when being converted back. The issue is that even
> tiny changes to a component float in LAB space can bring the color
> value down by 0.00000x or something in RGB and when it's converted
> back to hex it gets a surprising value.
> I think I propose this change making rounding optional so that it
> doesn't affect anyone who is depending on the current behaviour.
> (defun solarized-color-rgb-to-hex (red green blue &optional digits-per-component
> round)

Was this meant to be added to the solarized package, or to the in-tree
`color-rgb-to-hex' function?

Yes the in tree one, I added the change locally to that theme to avoid getting the rounding issues but I forgot to remove the prefix when posting to the e-mail list.

I am really not sure if rounding should just always be applied or if it should be optional, I can't see many situations when you would not want to round but at the same time it will change colors in existing code ever so slightly.

> 2. typos (?) in color-srgb-to-xyz typos
> While looking at the issue and referencing the wikipedia sRGB page it
> seems like these values should be changed.. Doing this upset the tests
> a bit though so I didn't take it all the way because I started trying
> to understand how to actually produce test case data that is based on
> some verified numbers and not just the output of color.el's functions.

I don't know, either.  Is this related to bug#41544, perhaps?

I don't think color-distance has anything to do with color.el at all.

Fixing these small value changes doesn't practically change much as far as I could see except that color-tests.el maybe shouldn't assume that it's own internal functions are correct when testing. 

I mostly want good test data for the ciede2000 function, there is probably good test data available here but it's unlikely to be usable in emacs due to licensing. http://www2.ece.rochester.edu/~gsharma/ciede2000/ I might resume work on finding better test data a little later and then create a patch of it all.

(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

Thomas Frössman

reply via email to

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