DIRED 1 "17 August 1998" "Version 4.01" [section 6 of 13]

.-3[DESCRIPTION]         .-2[OPTIONS]         .-1[KEYBOARD COMMANDS]
Top
.+1[DIAGNOSTICS]     .+2[ENVIRONMENT VARIABLES]         .+3[FILES]


COLOR SUPPORT

From version 4.00, dired supports color coding of files by type and by extension.

The color support is identical to that provided by the GNU ls(1) command: if the terminal type defined by the TERM environment variable is known to support color (i.e., is one of con132x25, con132x30, con132x43, con132x60, con80x25, con80x28, con80x30, con80x43, con80x50, con80x60, console, linux, vt100, or xterm), then built-in defaults determine file colors.

Do not be disappointed if your terminal type is one of the above, but the output is still monochrome: only recent versions of UNIX terminal emulators, such as xterm(1), contain support for text color beyond the normal foreground and background colors. However, all should have at least bold, flashing, underlined, and reverse video capability.

The defaults can be overridden by settings of the LS_COLORS (or LS_COLOURS) environment variable; that variable augments, but does not eliminate, the internal defaults. Thus, for customization, the user need only supply changed values.

The value of the LS_COLORS variable is a termcap(1)-like capability list: a colon-separated list of key=value pairs. As in computer programming languages, when there are repeated assignments to the same key name, only the last is effective.

Keys may be one of these file types or commands:

bd
block device,
cd
character device,
di
directory,
ec
end control sequence code (replaces lc+no+rc),
ex
executable file,
fi
regular file,
lc
left control sequence code,
ln
symbolic link,
mi
missing file (defaults to fi),
no
normal (non-filename) text,
or
orphaned symbolic link (defaults to ln),
pi
named pipe (FIFO),
rc
right control sequence code,
so
socket.

Keys may also be of the form *.ext to select files by dotted extension.

Values are terminal color control sequences, usually semicolon-separated lists of numbers, as follows:

0
restore default color
1
brighter colors
4
underlined text
5
flashing text
7
reverse video
30
black foreground
31
red foreground
32
green foreground
33
yellow (or brown) foreground
34
blue foreground
35
purple foreground
36
cyan foreground
37
white (or gray) foreground
40
black background
41
red background
42
green background
43
yellow (or brown) background
44
blue background
45
purple background
46
cyan background
47
white (or gray) background

For convenience, here is the same data, sorted by color names instead of color numbers:

40
black background
30
black foreground
44
blue background
34
blue foreground
46
cyan background
36
cyan foreground
42
green background
32
green foreground
45
purple background
35
purple foreground
41
red background
31
red foreground
47
white (or gray) background
37
white (or gray) foreground
43
yellow (or brown) background
33
yellow (or brown) foreground

Any required special characters in capability values can be represented by backslash or caret escape sequences:

\?
rubout (ASCII DELete)
\_
space
\a
alert (ASCII BEL)
\b
backspace (ASCII BS)
\e
escape (ASCII ESCape)
\f
formfeed (ASCII FF)
\n
newline (ASCII NL)
\ooo
3-octal-digit character value
\r
carriage return (ASCII CR)
\t
horizontal tab (ASCII HT)
\v
vertical tab (ASCII VT)
\xhh
2-or-more-hexadecimal-digit character value
^x
Control character formed from the five low-order bits of the character `x'

Backslash can also be used to protect other characters, notably, backslash, colon, and equals, from misinterpretation: `\' reduces to a single `\', and `e:' to a non-separating colon.

The GNU dircolors(1) command can be used to display the default setting of LS_COLORS used by dired. For convenience, the default is displayed here, but for readability, newlines have been inserted after the colons separating key=value pairs, and the pairs have been sorted into ascending order:

*.arj=01;31:
*.avi=01;37:
*.bmp=01;35:
*.deb=01;31:
*.dl=01;37:
*.gif=01;35:
*.gl=01;37:
*.gz=01;31:
*.jpg=01;35:
*.lzh=01;31:
*.mpg=01;37:
*.ppm=01;35:
*.tar=01;31:
*.taz=01;31:
*.tga=01;35:
*.tgz=01;31:
*.tif=01;35:
*.xbm=01;35:
*.xpm=01;35:
*.Z=01;31:
*.z=01;31:
*.zip=01;31:
bd=40;33;01:
cd=40;33;01:
di=01;34:
ex=01;32:
fi=0:
lc=\e[:
ln=01;36:
no=0:
or=40;31;01:
pi=40;33:
rc=m:
so=01;35:

dired writes each filename to the screen in the form <lc><colorcode><rc><filename><ec>. If the ec command is undefined, the sequence <lc><no><rc> is used instead. For example, the default setting shown above for the di directory file capability, 01;34, produces bright blue text on the screen background, and the character string that is output to the screen is \e[01;34mfilename\e[0m.

If you routinely use colored screen backgrounds, you should define background, as well as foreground, colors in each color capability value; otherwise, you may find that the color selected for certain files is difficult, or impossible, to see against the colored background.


.-3[DESCRIPTION]         .-2[OPTIONS]         .-1[KEYBOARD COMMANDS]
Top
.+1[DIAGNOSTICS]     .+2[ENVIRONMENT VARIABLES]         .+3[FILES]