bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#25890: `color-values` gives wrong value


From: Lars Ingebrigtsen
Subject: bug#25890: `color-values` gives wrong value
Date: Sat, 04 Mar 2017 16:44:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> (apply #'color-rgb-to-hex `(,@(color-name-to-rgb "#ffffff") 2))
>>      => "#fefefe"
>> 
>> (apply #'color-rgb-to-hex `(,@(color-name-to-rgb "#fff") 2))
>>      => "#efefef"
>> 
>> Where I would like both to give back "#ffffff". Does this mean that I
>> have to ensure that input to `color-name-to-rgb' uses 4 digits per
>> component?
>
> Yes, IMO.  Emacs does all its calculations with color components
> assuming 16 bits per component.  Applications that need to use fewer
> digits and have the missing digits as something other than zero, need
> to do that in application code.

I haven't followed this discussion closely, but you've changed the way
color-rgb-to-rgb works in an incompatible way?  I don't think that makes
much sense -- it's a function we must assume is used by third party code
and that's supposed to return certain values on certain inputs.

If you want to have a function that does something else, I think it
would make more sense to introduce new functions that does this
"something new" (i.e., 16 bit component parsing instead of HTML-like
color parsing, which is what those functions are supposed to do), and
revert the old functions how they used to work.

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





reply via email to

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