unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Why min-colors 88?
@ 2006-02-03 19:50 Bill Wohler
  2006-02-04 11:11 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Bill Wohler @ 2006-02-03 19:50 UTC (permalink / raw)


Can anyone explain the magic number 88 to me? Why is this used throughout Emacs?
Why is this the default generated when customizing a face (on devices
with lots of colors)?

I'd understand 16 (larger than the number of colors in the console and
the number of names defined by W3C HTML 4.0), 216 ("web-safe" or 256-40
colors reserved by the OS), and 256.

An MH-E developer has a device where (device-color-cells) returns 64.
What harm could there be in changing our specifications to use 64
instead of 88?

Finally, why are there a lot of faces with seemingly redundant
specifications such as this?

  (defface highlight
    '((((class color) (min-colors 88) (background light))
       :background "darkseagreen2")
      (((class color) (min-colors 88) (background dark))
       :background "darkolivegreen")
      (((class color) (min-colors 16) (background light))
       :background "darkseagreen2")
      (((class color) (min-colors 16) (background dark))
       :background "darkolivegreen")
      (((class color) (min-colors 8))
       :background "green" :foreground "black")
      (t :inverse-video t))
    "Basic face for highlighting."
    :group 'basic-faces)

Seems that this could be simply represented as:

  (defface highlight
    '((((class color) (min-colors 16) (background light))
       :background "darkseagreen2")
      (((class color) (min-colors 16) (background dark))
       :background "darkolivegreen")
      (((class color) (min-colors 8))
       :background "green" :foreground "black")
      (t :inverse-video t))
    "Basic face for highlighting."
    :group 'basic-faces)

Thanks.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

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

* Re: Why min-colors 88?
  2006-02-03 19:50 Why min-colors 88? Bill Wohler
@ 2006-02-04 11:11 ` Eli Zaretskii
  2006-02-05  6:18   ` Bill Wohler
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2006-02-04 11:11 UTC (permalink / raw)


> Date: Fri, 03 Feb 2006 11:50:46 -0800
> From: Bill Wohler <wohler@newt.com>
> 
> Can anyone explain the magic number 88 to me? Why is this used throughout Emacs?
> Why is this the default generated when customizing a face (on devices
> with lots of colors)?

Because there's an 88-color xterm whose color set is rich enough to
support all the colors we use in Emacs' faces.

> I'd understand 16 (larger than the number of colors in the console and
> the number of names defined by W3C HTML 4.0), 216 ("web-safe" or 256-40
> colors reserved by the OS), and 256.

We found that 256/216 colors are indistinguishable from 88,
practically speaking.

> An MH-E developer has a device where (device-color-cells) returns 64.

Out of curiosity, what device is that?

In any case, there's no support in Emacs for such devices right now,
i.e. there's no 64-color set that can be used to map the face colors
using the tty-colors.el machinery.  So I wonder how does that
developer use his/her device with Emacs.

> What harm could there be in changing our specifications to use 64
> instead of 88?

I don't know.  To find out, someone will have to:

  . find out what colors, in terms of RGB values, are defined on that
    device
  . map the colors used by Emacs (e.g. in color-name-rgb-alist) into
    those 64 colors, using tty-color-translate
  . see how many Emacs colors map to the same color on the 64-color
    deives, and
  . draw the conclusions.

> Finally, why are there a lot of faces with seemingly redundant
> specifications such as this?
> 
>   (defface highlight
>     '((((class color) (min-colors 88) (background light))
>        :background "darkseagreen2")
>       (((class color) (min-colors 88) (background dark))
>        :background "darkolivegreen")
>       (((class color) (min-colors 16) (background light))
>        :background "darkseagreen2")
>       (((class color) (min-colors 16) (background dark))
>        :background "darkolivegreen")
>       (((class color) (min-colors 8))
>        :background "green" :foreground "black")
>       (t :inverse-video t))
>     "Basic face for highlighting."
>     :group 'basic-faces)

The main reason is to allow an easy modification of the defaults for
88-and-up color terminals in the future.  The 88-color support is new
with Emacs 22, so for now, we just duplicated the old definitions.  We
expect them to change as user experience is gained when Emacs 22 is
released.

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

* Re: Why min-colors 88?
  2006-02-04 11:11 ` Eli Zaretskii
@ 2006-02-05  6:18   ` Bill Wohler
  2006-02-05 13:42     ` Stefan Monnier
  2006-02-05 19:55     ` Eli Zaretskii
  0 siblings, 2 replies; 10+ messages in thread
From: Bill Wohler @ 2006-02-05  6:18 UTC (permalink / raw)
  Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Fri, 03 Feb 2006 11:50:46 -0800
>> From: Bill Wohler <wohler@newt.com>
>> 
>> Can anyone explain the magic number 88 to me? Why is this used
>> throughout Emacs? Why is this the default generated when
>> customizing a face (on devices with lots of colors)?
>
> Because there's an 88-color xterm whose color set is rich enough to
> support all the colors we use in Emacs' faces.

Or in other words, Emacs' has 88 faces?

>> An MH-E developer has a device where (device-color-cells) returns 64.
>
> Out of curiosity, what device is that?

Eric?

> In any case, there's no support in Emacs for such devices right now,
> i.e. there's no 64-color set that can be used to map the face colors
> using the tty-colors.el machinery.  So I wonder how does that
> developer use his/her device with Emacs.
>
>> What harm could there be in changing our specifications to use 64
>> instead of 88?
>
> I don't know.  To find out, someone will have to:
>
>   . find out what colors, in terms of RGB values, are defined on that
>     device
>   . map the colors used by Emacs (e.g. in color-name-rgb-alist) into
>     those 64 colors, using tty-color-translate
>   . see how many Emacs colors map to the same color on the 64-color
>     deives, and
>   . draw the conclusions.

Objectively, if the colors that we use do not map to the same color,
we should be OK, right? Subjectively, the MH-E colors should map to a
pleasing set.

>> Finally, why are there a lot of faces with seemingly redundant
>> specifications such as this?
>> 
>>   (defface highlight
>>     '((((class color) (min-colors 88) (background light))
>>        :background "darkseagreen2")
>>       (((class color) (min-colors 88) (background dark))
>>        :background "darkolivegreen")
>>       (((class color) (min-colors 16) (background light))
>>        :background "darkseagreen2")
>>       (((class color) (min-colors 16) (background dark))
>>        :background "darkolivegreen")
>>       (((class color) (min-colors 8))
>>        :background "green" :foreground "black")
>>       (t :inverse-video t))
>>     "Basic face for highlighting."
>>     :group 'basic-faces)
>
> The main reason is to allow an easy modification of the defaults for
> 88-and-up color terminals in the future.  The 88-color support is new
> with Emacs 22, so for now, we just duplicated the old definitions.  We
> expect them to change as user experience is gained when Emacs 22 is
> released.

Thanks, Eli.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

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

* Re: Why min-colors 88?
  2006-02-05  6:18   ` Bill Wohler
@ 2006-02-05 13:42     ` Stefan Monnier
  2006-02-05 17:05       ` Bill Wohler
  2006-02-05 19:55     ` Eli Zaretskii
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2006-02-05 13:42 UTC (permalink / raw)
  Cc: emacs-devel, mh-e-devel

>>> Can anyone explain the magic number 88 to me? Why is this used
>>> throughout Emacs? Why is this the default generated when
>>> customizing a face (on devices with lots of colors)?
>> 
>> Because there's an 88-color xterm whose color set is rich enough to
>> support all the colors we use in Emacs' faces.

> Or in other words, Emacs' has 88 faces?

Well, 88 foreground * 88 background * 2 slants * 2 darknesses * a bunch of
sizes * a handful of fonts (* 89 colors of underlining * ...) is slightly
more than 88.
Then add to it the fact that many faces are identical.


        Stefan


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642

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

* Re: Why min-colors 88?
  2006-02-05 13:42     ` Stefan Monnier
@ 2006-02-05 17:05       ` Bill Wohler
  2006-02-05 18:49         ` Dan Nicolaescu
  2006-02-06  2:32         ` Stefan Monnier
  0 siblings, 2 replies; 10+ messages in thread
From: Bill Wohler @ 2006-02-05 17:05 UTC (permalink / raw)
  Cc: mh-e-devel, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> >>> Can anyone explain the magic number 88 to me? Why is this used
> >>> throughout Emacs? Why is this the default generated when
> >>> customizing a face (on devices with lots of colors)?
> >> 
> >> Because there's an 88-color xterm whose color set is rich enough to
> >> support all the colors we use in Emacs' faces.
> 
> > Or in other words, Emacs' has 88 faces?
> 
> Well, 88 foreground * 88 background * 2 slants * 2 darknesses * a bunch of
> sizes * a handful of fonts (* 89 colors of underlining * ...) is slightly
> more than 88.
> Then add to it the fact that many faces are identical.

Whoops, I meant to say 88 different colors in all of its faces.

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

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

* Re: Why min-colors 88?
  2006-02-05 17:05       ` Bill Wohler
@ 2006-02-05 18:49         ` Dan Nicolaescu
  2006-02-05 22:31           ` Bill Wohler
  2006-02-06  2:32         ` Stefan Monnier
  1 sibling, 1 reply; 10+ messages in thread
From: Dan Nicolaescu @ 2006-02-05 18:49 UTC (permalink / raw)
  Cc: mh-e-devel

Bill Wohler <wohler@newt.com> writes:

  > Stefan Monnier <monnier@iro.umontreal.ca> wrote:
  > 
  > > >>> Can anyone explain the magic number 88 to me? Why is this used
  > > >>> throughout Emacs? Why is this the default generated when
  > > >>> customizing a face (on devices with lots of colors)?
  > > >> 
  > > >> Because there's an 88-color xterm whose color set is rich enough to
  > > >> support all the colors we use in Emacs' faces.
  > > 
  > > > Or in other words, Emacs' has 88 faces?
  > > 
  > > Well, 88 foreground * 88 background * 2 slants * 2 darknesses * a bunch of
  > > sizes * a handful of fonts (* 89 colors of underlining * ...) is slightly
  > > more than 88.
  > > Then add to it the fact that many faces are identical.
  > 
  > Whoops, I meant to say 88 different colors in all of its faces.

No, (min-colors 88) means that the device that emacs uses for display
guarantees that it can display at least 88 distinct colors.

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

* Re: Why min-colors 88?
  2006-02-05  6:18   ` Bill Wohler
  2006-02-05 13:42     ` Stefan Monnier
@ 2006-02-05 19:55     ` Eli Zaretskii
  1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2006-02-05 19:55 UTC (permalink / raw)
  Cc: mh-e-devel, emacs-devel

> From: Bill Wohler <wohler@newt.com>
> Date: Sat, 04 Feb 2006 22:18:38 -0800
> Cc: mh-e-devel@lists.sourceforge.net
> 
> > Because there's an 88-color xterm whose color set is rich enough to
> > support all the colors we use in Emacs' faces.
> 
> Or in other words, Emacs' has 88 faces?

No, it has much less.  But we tried all the colors in tty-colors.el,
and the 88-color xterm distinguishes them enough for us to decide that
88 colors are like 256 for all practical purposes.

In other words, 88-color xterm will support any faces that could be
defined in the future as well as the X version of Emacs.

> >   . find out what colors, in terms of RGB values, are defined on that
> >     device
> >   . map the colors used by Emacs (e.g. in color-name-rgb-alist) into
> >     those 64 colors, using tty-color-translate
> >   . see how many Emacs colors map to the same color on the 64-color
> >     deives, and
> >   . draw the conclusions.
> 
> Objectively, if the colors that we use do not map to the same color,
> we should be OK, right?

Yes.

> Subjectively, the MH-E colors should map to a pleasing set.

Yes.

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

* Re: Why min-colors 88?
  2006-02-05 18:49         ` Dan Nicolaescu
@ 2006-02-05 22:31           ` Bill Wohler
  2006-02-06  1:41             ` Miles Bader
  0 siblings, 1 reply; 10+ messages in thread
From: Bill Wohler @ 2006-02-05 22:31 UTC (permalink / raw)
  Cc: mh-e-devel, emacs-devel

Dan Nicolaescu <dann@ics.uci.edu> wrote:

> Bill Wohler <wohler@newt.com> writes:
> 
>   > Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>   > 
>   > > >>> Can anyone explain the magic number 88 to me? Why is this used
>   > > >>> throughout Emacs? Why is this the default generated when
>   > > >>> customizing a face (on devices with lots of colors)?
>   > > >> 
>   > > >> Because there's an 88-color xterm whose color set is rich enough to
>   > > >> support all the colors we use in Emacs' faces.
>   > > 
>   > > > Or in other words, Emacs' has 88 faces?
>   > > 
>   > > Well, 88 foreground * 88 background * 2 slants * 2 darknesses * a bunch of
>   > > sizes * a handful of fonts (* 89 colors of underlining * ...) is slightly
>   > > more than 88.
>   > > Then add to it the fact that many faces are identical.
>   > 
>   > Whoops, I meant to say 88 different colors in all of its faces.
> 
> No, (min-colors 88) means that the device that emacs uses for display
> guarantees that it can display at least 88 distinct colors.

Hi Dan, we weren't talking about the definition of min-color, but rather
the rationale between how 88 was chosen.

If Emacs uses less than 64 colors, and it looks good on Eric's device
where display-color-cells returns 64, and if Eric ensures that none of
the colors maps to the same device color*, then it's possible we might
consider lowering that number, eh? On the other hand, I think Eli was
implying that there was room for growth.

* I'm sure someone's written code to do perform this verification. Could
  someone save me a few minutes by posting it or a pointer to it?

-- 
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

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

* Re: Why min-colors 88?
  2006-02-05 22:31           ` Bill Wohler
@ 2006-02-06  1:41             ` Miles Bader
  0 siblings, 0 replies; 10+ messages in thread
From: Miles Bader @ 2006-02-06  1:41 UTC (permalink / raw)
  Cc: Dan Nicolaescu

2006/2/6, Bill Wohler <wohler@newt.com>:
> if Eric ensures that none of
> the colors maps to the same device color

I don't think this is necessary -- the question is not whether all
colors used in Emacs faces are unique, but whether _in practice_ the
result is confusing or not (and a bit of extra headroom for user
modifications).  With only 8 colors there's so much duplication that
it makes the user interface less usable (and so special treatment is
given low-color devices), but apparently 88 colors has proven "rich
enough" that this isn't the case.

Probably you can't really verify this mechanically, though a tool that
pointed out duplicate faces due to the restricted gamut might prove
useful in looking for problems.

-Miles
--
Do not taunt Happy Fun Ball.

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

* Re: Why min-colors 88?
  2006-02-05 17:05       ` Bill Wohler
  2006-02-05 18:49         ` Dan Nicolaescu
@ 2006-02-06  2:32         ` Stefan Monnier
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2006-02-06  2:32 UTC (permalink / raw)
  Cc: mh-e-devel

> Whoops, I meant to say 88 different colors in all of its faces.

Actually no.  All it really means is that the automatic color-approximation
algorithm used by Emacs works well enough on terminals with 88 colors and
up, so that more manual fiddling has not been needed.


        Stefan

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

end of thread, other threads:[~2006-02-06  2:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-03 19:50 Why min-colors 88? Bill Wohler
2006-02-04 11:11 ` Eli Zaretskii
2006-02-05  6:18   ` Bill Wohler
2006-02-05 13:42     ` Stefan Monnier
2006-02-05 17:05       ` Bill Wohler
2006-02-05 18:49         ` Dan Nicolaescu
2006-02-05 22:31           ` Bill Wohler
2006-02-06  1:41             ` Miles Bader
2006-02-06  2:32         ` Stefan Monnier
2006-02-05 19:55     ` Eli Zaretskii

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