unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Thomas Frössman" <thomasf@jossystem.se>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: color-rgb-to-hex rounding / color-srgb-to-xyz typos
Date: Wed, 20 Jan 2021 16:17:31 +0100	[thread overview]
Message-ID: <CANDWisCbSkguBjSmYZEa272q2jpZ7bXpWfonTOC=NWk032PmQw@mail.gmail.com> (raw)
In-Reply-To: <87wnw9r3zv.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 2615 bytes --]

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
http://t.jossystem.se

[-- Attachment #2: Type: text/html, Size: 3836 bytes --]

      reply	other threads:[~2021-01-20 15:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 11:23 color-rgb-to-hex rounding / color-srgb-to-xyz typos Thomas Frössman
2021-01-19  3:37 ` Lars Ingebrigtsen
2021-01-20 15:17   ` Thomas Frössman [this message]

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='CANDWisCbSkguBjSmYZEa272q2jpZ7bXpWfonTOC=NWk032PmQw@mail.gmail.com' \
    --to=thomasf@jossystem.se \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /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).