Skip to main content

C.7 Window Color Options

You can use the following command-line options to specify the colors to use for various parts of the Emacs display. Colors may be specified using either color names or RGB triplets (see Colors).

β€˜-fg color’​

β€˜--foreground-color=color’​

Specify the foreground color, overriding the color specified by the default face (see Faces).

β€˜-bg color’​

β€˜--background-color=color’​

Specify the background color, overriding the color specified by the default face.

β€˜-bd color’​

β€˜--border-color=color’​

Specify the color of the border of the X window. This has no effect if Emacs is compiled with GTK+ support.

β€˜-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’​

Set the color support mode when Emacs is run on a text terminal. This option overrides the number of supported colors that the character terminal advertises in its termcap or terminfo database. 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 terminals as well as on graphical displays.