Colour themes
You can theme exa’s output using the
LS_COLORS
and
EXA_COLORS
environment variables,
which modify the colours used by filenames and other parts of the output.
By configuring one or both of these variables, you can tell exa to highlight certain files in a particular way; by configuring them a lot more, you can even change the way exa looks completely.
File extensions and colours
Although exa knows about a large number of file extensions,
its list will never be fully complete.
Perhaps your workflow involves processing files in an uncommon format, say, .xyz
;
other extensions, such as .ts
, have multiple meanings that exa may treat as a false positive.
ls
supports changing this behaviour by setting the LS_COLORS
variable. Its format is a list of pairs of file name globs and colour codes, separated by equals signs, and then separated again with colons between the pairs:
The file name globs use the same format as ignoring files by glob does.
So in order to highlight .xyz
files in an extremely visible colour — let’s say white on red — you would set:
To additionally set .ts
files to a more calming blue, you would set:
It’s not the easiest syntax to read, so it’s important to notice the difference between the colons used to separate pairs from the semicolons used to write the colour codes.
File class colours
Before looking at a file’s extension, exa looks at the file’s class in the filesystem — whether it’s a directory, a socket, a link, or (in a special case) an executable file.
You can customise the colours used for each file by using one of these two-character-long keys with a colour:
fi
Normal filedi
Directoryex
Executable filepi
Named pipeso
Socketbd
Block devicecd
Character deviceln
Symlinkor
Broken symlink
For example, if you wanted to change both block and character devices to purple, you’d use:
Customising exa’s interface
exa has its own environment variable, EXA_COLORS
, which can be used as an exa-specific version of LS_COLORS
.
File classes and globs in this variable will be read by exa but won’t be read by ls
.
The other more important use of EXA_COLORS
is that you can use it to customise parts of exa’s interface, including the colours for the permission bits, the date, user, inode, and other metadata columns, and punctuation such as arrows and tree characters.
To change these colours, set the relevant key in EXA_COLORS
to the colour code you want.
Permissions
ur
User+r
bituw
User+w
bitux
User+x
bit (files)ue
User+x
bit (file types)gr
Group+r
bitgw
Group+w
bitgx
Group+x
bittr
Others+r
bittw
Others+w
bittx
Others+x
bitsu
Higher bits (files)sf
Higher bits (other types)xa
Extended attribute marker
File sizes
sn
Size numberssb
Size unitdf
Major device IDds
Minor device ID
Owners and Groups
uu
A user that’s youun
A user that’s notgu
A group with you in itgn
A group without you
Hard links
lc
Number of linkslm
A multi-link file
Git
ga
Newgm
Modifiedgd
Deletedgv
Renamedgt
Type change
Details and metadata
xx
Punctuationda
Timestampin
File inodebl
Number of blockshd
Table header rowlp
Symlink pathcc
Control character
Overlays
bO
Broken link path
Here’s how you make timestamps a brighter shade of blue:
Colour codes
The colour codes used in LS_COLORS
and EXA_COLORS
are ANSI escape codes.
These codes can tell the terminal emulator to do all sorts of things, including moving the cursor around and scrolling up and down, but exa only uses the ones that change the text colour.
To use them, combine one or more of the following with semicolons:
Foreground
30
Black31
Red32
Green33
Yellow34
Blue35
Purple36
Cyan37
White
Background
40
On black41
On red42
On green43
On yellow44
On blue45
On purple46
On cyan47
On white
Effects
01
Bold04
Underline
256 colours
38;5;nnn
Foreground48;5;nnn
Background
Here’s what you’d use for a bold-and-white-on-red file that means Java just crashed: