unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24273: 25.1.50; Unexpected return value from `color-name-to-rgb'
@ 2016-08-20  9:47 Simen Heggestøyl
  2016-08-20 10:06 ` Julien Danjou
  0 siblings, 1 reply; 9+ messages in thread
From: Simen Heggestøyl @ 2016-08-20  9:47 UTC (permalink / raw)
  To: 24273; +Cc: julien

The docstring for `color-name-to-rgb' states the following:

"Normally the return value is a list of three floating-point numbers,
(RED GREEN BLUE), each between 0.0 and 1.0 inclusive."

When passing the hex value for white the return value is as expected:

     (color-name-to-rgb "#ffffff")
          ⇒ (1.0 1.0 1.0)

But when passing the name of the same color, the return value becomes
different:

     (color-name-to-rgb "white")
          ⇒ (1.00390625 1.00390625 1.00390625)


In GNU Emacs 25.1.50.134 (x86_64-pc-linux-gnu, GTK+ Version 3.20.7)
 of 2016-08-20 built on x240
Repository revision: a4ba426d25bd6a5cbe11d81b82a789b8a2c948ed
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:	Debian GNU/Linux testing (stretch)

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS NOTIFY GNUTLS LIBXML2
FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr ispell emacsbug message subr-x puny seq byte-opt
gv bytecomp byte-compile cl-extra help-mode cconv cl-loaddefs pcase
cl-lib dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec
password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 99389 6019)
 (symbols 48 20750 0)
 (miscs 40 46 109)
 (strings 32 18640 5788)
 (string-bytes 1 591726)
 (vectors 16 13763)
 (vector-slots 8 450400 3027)
 (floats 8 183 16)
 (intervals 56 195 0)
 (buffers 976 11)
 (heap 1024 35065 1072))





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24273: 25.1.50; Unexpected return value from `color-name-to-rgb'
  2016-08-20  9:47 bug#24273: 25.1.50; Unexpected return value from `color-name-to-rgb' Simen Heggestøyl
@ 2016-08-20 10:06 ` Julien Danjou
  2016-08-20 10:11   ` Simen Heggestøyl
  0 siblings, 1 reply; 9+ messages in thread
From: Julien Danjou @ 2016-08-20 10:06 UTC (permalink / raw)
  To: Simen Heggestøyl; +Cc: 24273

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

On Sat, Aug 20 2016, Simen Heggestøyl wrote:

> The docstring for `color-name-to-rgb' states the following:
>
> "Normally the return value is a list of three floating-point numbers,
> (RED GREEN BLUE), each between 0.0 and 1.0 inclusive."
>
> When passing the hex value for white the return value is as expected:
>
>      (color-name-to-rgb "#ffffff")
>           ⇒ (1.0 1.0 1.0)
>
> But when passing the name of the same color, the return value becomes
> different:
>
>      (color-name-to-rgb "white")
>           ⇒ (1.00390625 1.00390625 1.00390625)

What are the return values of:
 (color-values "white")
and
 (color-values "#ffffff")
?

-- 
Julien Danjou
/* Free Software hacker
   https://julien.danjou.info */

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24273: 25.1.50; Unexpected return value from `color-name-to-rgb'
  2016-08-20 10:06 ` Julien Danjou
@ 2016-08-20 10:11   ` Simen Heggestøyl
  2016-08-20 11:34     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Simen Heggestøyl @ 2016-08-20 10:11 UTC (permalink / raw)
  To: Julien Danjou; +Cc: 24273

On Sat, Aug 20, 2016 at 12:06 PM, Julien Danjou <julien@danjou.info> 
wrote:
> What are the return values of:
>  (color-values "white")
> and
>  (color-values "#ffffff")
> ?

(color-values "white")
     ⇒ (65535 65535 65535)

(color-values "#ffffff")
     ⇒ (65280 65280 65280)

-- Simen






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24273: 25.1.50; Unexpected return value from `color-name-to-rgb'
  2016-08-20 10:11   ` Simen Heggestøyl
@ 2016-08-20 11:34     ` Eli Zaretskii
  2016-08-20 12:07       ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2016-08-20 11:34 UTC (permalink / raw)
  To: Simen Heggestøyl; +Cc: julien, 24273

> Date: Sat, 20 Aug 2016 12:11:46 +0200
> From: Simen Heggestøyl <simenheg@gmail.com>
> Cc: 24273@debbugs.gnu.org
> 
> On Sat, Aug 20, 2016 at 12:06 PM, Julien Danjou <julien@danjou.info> 
> wrote:
> > What are the return values of:
> >  (color-values "white")
> > and
> >  (color-values "#ffffff")
> > ?
> 
> (color-values "white")
>      ⇒ (65535 65535 65535)
> 
> (color-values "#ffffff")
>      ⇒ (65280 65280 65280)

Which means "white" and "#ffffff" are not the same color.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24273: 25.1.50; Unexpected return value from `color-name-to-rgb'
  2016-08-20 11:34     ` Eli Zaretskii
@ 2016-08-20 12:07       ` Andreas Schwab
  2016-08-20 12:17         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2016-08-20 12:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: julien, Simen Heggestøyl, 24273

On Aug 20 2016, Eli Zaretskii <eliz@gnu.org> wrote:

>> Date: Sat, 20 Aug 2016 12:11:46 +0200
>> From: Simen Heggestøyl <simenheg@gmail.com>
>> Cc: 24273@debbugs.gnu.org
>> 
>> On Sat, Aug 20, 2016 at 12:06 PM, Julien Danjou <julien@danjou.info> 
>> wrote:
>> > What are the return values of:
>> >  (color-values "white")
>> > and
>> >  (color-values "#ffffff")
>> > ?
>> 
>> (color-values "white")
>>      ⇒ (65535 65535 65535)
>> 
>> (color-values "#ffffff")
>>      ⇒ (65280 65280 65280)
>
> Which means "white" and "#ffffff" are not the same color.

Actually they are, because #ffffff and #ffffffffffff are the same color
on a display with 8 bits per color.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24273: 25.1.50; Unexpected return value from `color-name-to-rgb'
  2016-08-20 12:07       ` Andreas Schwab
@ 2016-08-20 12:17         ` Eli Zaretskii
  2016-08-20 12:32           ` Julien Danjou
  2016-08-20 14:23           ` Andreas Schwab
  0 siblings, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2016-08-20 12:17 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: julien, simenheg, 24273

> From: Andreas Schwab <schwab@linux-m68k.org>
> Cc: Simen Heggestøyl <simenheg@gmail.com>,
>   julien@danjou.info,  24273@debbugs.gnu.org
> Date: Sat, 20 Aug 2016 14:07:08 +0200
> 
> On Aug 20 2016, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> >> Date: Sat, 20 Aug 2016 12:11:46 +0200
> >> From: Simen Heggestøyl <simenheg@gmail.com>
> >> Cc: 24273@debbugs.gnu.org
> >> 
> >> On Sat, Aug 20, 2016 at 12:06 PM, Julien Danjou <julien@danjou.info> 
> >> wrote:
> >> > What are the return values of:
> >> >  (color-values "white")
> >> > and
> >> >  (color-values "#ffffff")
> >> > ?
> >> 
> >> (color-values "white")
> >>      ⇒ (65535 65535 65535)
> >> 
> >> (color-values "#ffffff")
> >>      ⇒ (65280 65280 65280)
> >
> > Which means "white" and "#ffffff" are not the same color.
> 
> Actually they are, because #ffffff and #ffffffffffff are the same color
> on a display with 8 bits per color.

I don't think I follow you.  What does 8 bits per color have to do
with this, and how do you know the OP has 8 bits per color on his
display?

FWIW, on my display, I get (65535 65535 65535) for both expressions.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24273: 25.1.50; Unexpected return value from `color-name-to-rgb'
  2016-08-20 12:17         ` Eli Zaretskii
@ 2016-08-20 12:32           ` Julien Danjou
  2016-08-22  6:12             ` Simen Heggestøyl
  2016-08-20 14:23           ` Andreas Schwab
  1 sibling, 1 reply; 9+ messages in thread
From: Julien Danjou @ 2016-08-20 12:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Andreas Schwab, simenheg, 24273

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

On Sat, Aug 20 2016, Eli Zaretskii wrote:

> I don't think I follow you.  What does 8 bits per color have to do
> with this, and how do you know the OP has 8 bits per color on his
> display?
>
> FWIW, on my display, I get (65535 65535 65535) for both expressions.

I get (65280 65280 65280) for both on my display.

The problem is that `color-name-to-rgb' expect to find the brightest
point by calling (color-values "#ffffff") whereas it seems in this case
it's less bright than "white". Is that something possible?

What kind of system are you running Simen?

-- 
Julien Danjou
;; Free Software hacker
;; https://julien.danjou.info

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24273: 25.1.50; Unexpected return value from `color-name-to-rgb'
  2016-08-20 12:17         ` Eli Zaretskii
  2016-08-20 12:32           ` Julien Danjou
@ 2016-08-20 14:23           ` Andreas Schwab
  1 sibling, 0 replies; 9+ messages in thread
From: Andreas Schwab @ 2016-08-20 14:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: julien, simenheg, 24273

On Aug 20 2016, Eli Zaretskii <eliz@gnu.org> wrote:

> I don't think I follow you.  What does 8 bits per color have to do
> with this,

Only the upper 8 bits are significant.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#24273: 25.1.50; Unexpected return value from `color-name-to-rgb'
  2016-08-20 12:32           ` Julien Danjou
@ 2016-08-22  6:12             ` Simen Heggestøyl
  0 siblings, 0 replies; 9+ messages in thread
From: Simen Heggestøyl @ 2016-08-22  6:12 UTC (permalink / raw)
  To: Julien Danjou; +Cc: Andreas Schwab, 24273

On Sat, Aug 20, 2016 at 2:32 PM, Julien Danjou <julien@danjou.info> 
wrote:
> I get (65280 65280 65280) for both on my display.
> 
> The problem is that `color-name-to-rgb' expect to find the brightest
> point by calling (color-values "#ffffff") whereas it seems in this 
> case
> it's less bright than "white". Is that something possible?
> 
> What kind of system are you running Simen?

I'm running Debian (testing).

-- Simen






^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-08-22  6:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-20  9:47 bug#24273: 25.1.50; Unexpected return value from `color-name-to-rgb' Simen Heggestøyl
2016-08-20 10:06 ` Julien Danjou
2016-08-20 10:11   ` Simen Heggestøyl
2016-08-20 11:34     ` Eli Zaretskii
2016-08-20 12:07       ` Andreas Schwab
2016-08-20 12:17         ` Eli Zaretskii
2016-08-20 12:32           ` Julien Danjou
2016-08-22  6:12             ` Simen Heggestøyl
2016-08-20 14:23           ` Andreas Schwab

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).