LS_COLORS/README.markdown

112 lines
3.5 KiB
Markdown
Raw Normal View History

2018-12-09 00:49:37 +01:00
### Table of contents
2022-03-09 17:19:28 +01:00
- [LS_COLORS](#ls_colors)
- [What does it look like?](#what-does-it-look-like)
- [Dependencies](#dependencies)
- [Installation](#installation)
- [Information for Developers](#information-for-developers)
- [Legal](#legal)
2011-04-09 19:14:13 +02:00
2018-12-09 00:49:37 +01:00
# LS_COLORS
2022-03-09 17:19:28 +01:00
This is a collection of extension:color mappings, suitable to use as your
`LS_COLORS` environment variable. Most of them use the extended color map,
described in the ECMA-48 document; in other words, you'll need a terminal
with capabilities of displaying 256 colors.
2011-04-09 19:14:13 +02:00
As of this writing, around 300 different filetypes/extensions is supported.
2011-09-17 09:46:53 +02:00
That's indeed a lot of extensions, but there's a lot more! Your help is greatly
appreciated.
2011-09-17 09:46:53 +02:00
Fork this project on github, add the extensions you are missing, and send a pull
request.
Some guidelines:
For files that usually ends up next to each other, like html, css and js,
2011-04-24 10:59:30 +02:00
try to pick colors that fits in nicely together. Filetypes with multiple
possible extensions, like htm and html, should have the same color.
# What does it look like?
2022-03-09 17:19:28 +01:00
2018-12-09 00:49:37 +01:00
Here's a screenshot _(font and minor color shades, of course, depend on terminal and its configuration)_:
2019-12-25 02:52:47 +01:00
![Screenshot1](docs/static/LS_COLORS.png)
2018-12-09 00:49:37 +01:00
2020-10-01 17:32:09 +02:00
# Dependencies
You need GNU `dircolors` and a compatible directory listing tool, such as GNU
`ls`. Both are available in GNU coreutils.
# Installation
2011-04-09 19:14:13 +02:00
2022-01-20 22:36:59 +01:00
The repo contains two compiled scripts `lscolors.sh` & `lscolors.csh`, which you can download & source directly or point your plugin manager to pick up one of them.
To enable the colors, add the following line to your shell's start-up script:
For Bourne shell (e.g. `~/.bashrc` or `~/.zshrc`):
2022-03-09 17:19:28 +01:00
2022-01-20 22:36:59 +01:00
```
source ~/path/to/lscolors.sh
```
For C shell (e.g. `~/.cshrc`):
2022-03-09 17:19:28 +01:00
2022-01-20 22:36:59 +01:00
```
source ~/path/to/lscolors.csh
```
If you prefer to manually generate these files, an installation script is provided with this repository:
```console
$ mkdir /tmp/LS_COLORS && curl -L https://api.github.com/repos/trapd00r/LS_COLORS/tarball/master | tar xzf - --directory=/tmp/LS_COLORS --strip=1
2022-01-20 22:36:59 +01:00
$ ( cd /tmp/LS_COLORS && make install )
To enable the colors, add the following line to your shell's start-up script:
For Bourne shell (e.g. ~/.bashrc or ~/.zshrc):
2022-01-20 22:36:59 +01:00
source "~/.local/share/lscolors.sh"
For C shell (e.g. ~/.cshrc):
2022-01-20 22:36:59 +01:00
source "~/.local/share/lscolors.csh"
$
```
2018-12-09 00:49:37 +01:00
## Arch Linux
2022-03-09 17:19:28 +01:00
2018-12-09 00:49:37 +01:00
Arch Linux users can install the [`lscolors-git`][3] package from the AUR for easy
integration with bash, csh, or zsh.
2018-12-09 00:01:16 +01:00
# Information for Developers
2022-03-09 17:19:28 +01:00
There's a [library][1] I've written that lets you use various LS COLORS on
arbitrary files and directories. A simple implementation can be found [here][2].
2011-04-09 19:14:13 +02:00
Using this, you can do
2022-03-09 17:19:28 +01:00
```shell
2018-12-09 00:49:37 +01:00
find $HOME -maxdepth 1 | ls_color
2011-04-09 19:14:13 +02:00
2018-12-09 00:49:37 +01:00
mpc search artist Laleh | ls_color
```
2011-04-09 19:14:13 +02:00
... and so on.
2019-12-25 02:52:47 +01:00
# Legal
2022-03-09 17:19:28 +01:00
2022-01-06 00:45:22 +01:00
© Copyright 2014-2022 Magnus Woldrich.
2014-06-04 18:08:16 +02:00
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the Perl Artistic License for more details.
This program is free software: you can redistribute it and/or modify it under
the terms of the Perl Artistic License as published by the Perl Foundation,
either version 1.0 of the License, or (at your option) any later version.
You should have received a copy of the Perl Artistic License along
with this program. If not, see <http://www.perlfoundation.org/artistic_license_1_0>.
2022-03-09 17:19:28 +01:00
[1]: https://github.com/trapd00r/File-LsColor
[2]: https://github.com/trapd00r/File-LsColor/tree/master/bin
[3]: https://aur.archlinux.org/packages/lscolors-git