[Top][All Lists]

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

Re: set-background-color

From: Eli Zaretskii
Subject: Re: set-background-color
Date: Sun, 17 Feb 2002 08:31:57 +0200

On 17 Feb 2002, Dan Jacobson wrote:

> 1. Didn't see error message: doing
> $ emacs -q -nw -bg '#139  69  19' #[yes, knowing that it will fail]
> starts an emacs with apparently no problems.  it is only when one
> purposely checks *Messages* buffer does one see
> "Unable to load color "#139  69  19" [10 times]"

It's a feature: failure to load colors is not fatal in Emacs, because 
such problems happen quite frequently (e.g., due to color depletion in 
the current colormap, a.k.a. palette).  If Emacs would bitch at you in 
every such situation, it would become an absolute nuisance.

> 2. in Info we see
>      COLOR can be an X-style `"#XXXYYYZZZ"' specification instead of an
>      actual name.  The format `"RGB:XX/YY/ZZ"' is also supported.
> Problems: A. this is noted in the context of -nw... one would wonder
>  if they are applicable to non -nw.

This fragment is from the ELisp manual, not from the user manual.  The X 
format is mentioned in the tty section because it is not natural for tty 
colors.  One hopes that a Lisp programmer working on X knows the 
standard X color notation.

In the user manual, the X notation is mentioned in the general section 
which describes the -fg and -bg command-line switches.

>           B. no models or place to get the color numbers are
>      mentioned.

It's explained in any X manual.

> D>  (set-background-color "chocolate4") doesn't work for emacs -nw on rxvt.
> E> How do you mean ``doesn't work''?  What happens if you try?
> ok, firstly, it wont let me type in chocolate4, so I picked magenta.
> All went well except my terminal didn't change color.
> If I do ESC :  (set-background-color "chocolate4") nothing happens
> either, I just see a "nil" returned.

"M-: (set-background-color "chocolate4") RET" works for me in the  
development version, but perhaps there was some problem that was fixed 
since v21.1 was released.

> there is a possibility that the guys who
> added big5 hurt something, just in case you dont have these problems.

??? Can you explain why would you expect these two issues to interact?

> E> Does it work to say "emacs -nw -bg chocolate4"?
> Yes [startled] this works.  It maps to some kind of red, but at least
> it does something.

Red is the closest color to chocolate4; what else did you expect?

> Anyways, Info should mention if this is the right way to get the hex
> values on needs to start adjusting colors with, e.g.,
> $ awk /Pink/'{printf "%02x%02x%02x %s\n", $1,$2,$3,$4}' 
> /usr/X11R6/lib/X11/rgb.txt

Sorry, I don't follow: are you saying that something in the user manual 
is unclear about using the colors in hex notation?  If so, please tell 
what is unclear, and what led you to the conclusion that you need to 
adjust colors in any way.

The manual doesn't mention any adjustments because there's no need for 

> Also Info should say "What to do if you feel a color is too dark or
> light, and want to fine tune it, finding no better color from
> list-colors-display

The way to do this is dependent on your display specifics.  For some 
displays, like consoles, there is no way at all.  I don't see how can the 
Emacs manual be expected to be a tutorial on setting up color terminals; 
please refer to your machine's documentation.

> [which doesn't show their #AAAAAA values [why not?]]..."

Emacs doesn't list hex color values for text colors because it doesn't know 

> How about some new functions: darken and lighten, for those of use who
> dont know how to do it with adjustments to (set-background-color
> "#8b6a62")

Are you talking about Emacs running on X or on a tty?

> [yes, in the non -nw case this works, however one cannot do
> M-x set-background-color, one must do M-: , as # is not allowed.]

In interactive usage, set-background-color provides completion, to ease 
the burden of typing the long color names.  The fact that you cannot 
choose hex notation there is a side effect of that completion.  I think 
completion is more important than the ability to use arbitrary hex values 
interactively, in this case.

Note that, at least for the tty case, the colors beyond the standard set 
provided by the text-mode display are supported only for the benefit of 
Lisp packages that don't have tty-specific color specifications.  Users 
are not supposed to need to mess with hex color values interactively, 
since they cannot get any color beyond the standard set, typically only 8 
standard ANSI colors.  That is, there's no reason to try to use hex 
colors or chocolate4 if all you get is red; just type "red".

> OK, so what do I want?  OK, I wish info would tell us how to make
> chocolate4 just a little darker.

On a tty? you can't.

reply via email to

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