C.8 Window Color Options
On a color display, you can specify which color to use for various
parts of the Emacs display. To find out what colors are available on
your system, type M-x list-colors-display, or press
C-Mouse-2 and select ‘Display Colors’ from the pop-up menu.
(A particular window system might support many more colors, but the
list displayed by list-colors-display
shows their portable
subset that can be safely used on any display supported by Emacs.)
If you do not specify colors, on windowed displays the default for the
background is white and the default for all other colors is black. On a
monochrome display, the foreground is black, the background is white,
and the border is gray if the display supports that. On terminals, the
background is usually black and the foreground is white.
Here is a list of the command-line options for specifying colors:
- ‘-fg color’
- ‘--foreground-color=color’
- Specify the foreground color. color should be a standard color
name, or a numeric specification of the color's red, green, and blue
components as in ‘#4682B4’ or ‘RGB:46/82/B4’.
- ‘-bg color’
- ‘--background-color=color’
- Specify the background color.
- ‘-bd color’
- ‘--border-color=color’
- Specify the color of the border of the X window.
- ‘-cr color’
- ‘--cursor-color=color’
- Specify the color of the Emacs cursor which indicates where point is.
- ‘-ms color’
- ‘--mouse-color=color’
- Specify the color for the mouse cursor when the mouse is in the Emacs window.
- ‘-r’
- ‘-rv’
- ‘--reverse-video’
- Reverse video—swap the foreground and background colors.
- ‘--color=mode’
- For a character terminal only, specify the mode of color support. The
parameter mode can be one of the following:
- ‘never’
- ‘no’
- Don't use colors even if the terminal's capabilities specify color
support.
- ‘default’
- ‘auto’
- Same as when --color is not used at all: Emacs detects at
startup whether the terminal supports colors, and if it does, turns on
colored display.
- ‘always’
- ‘yes’
- ‘ansi8’
- Turn on the color support unconditionally, and use color commands
specified by the ANSI escape sequences for the 8 standard colors.
- ‘num’
- Use color mode for num colors. If num is -1, turn off
color support (equivalent to ‘never’); if it is 0, use the
default color support for this terminal (equivalent to ‘auto’);
otherwise use an appropriate standard mode for num colors.
Depending on your terminal's capabilities, Emacs might be able to turn
on a color mode for 8, 16, 88, or 256 as the value of num. If
there is no mode that supports num colors, Emacs acts as if
num were 0, i.e. it uses the terminal's default color support
mode.
If mode is omitted, it defaults to ansi8.
For example, to use a coral mouse cursor and a slate blue text cursor,
enter:
emacs -ms coral -cr 'slate blue' &
You can reverse the foreground and background colors through the
‘-rv’ option or with the X resource ‘reverseVideo’.
The ‘-fg’, ‘-bg’, and ‘-rv’ options function on
text-only terminals as well as on window systems.