Find a file
2024-08-16 16:44:40 +00:00
.github/workflows test: Add regression test for non-existent env var 2023-11-27 03:09:42 -08:00
docs/static Add new & updated screenshot 2020-01-07 19:14:02 -08:00
tests test: Add regression test for non-existent env var 2023-11-27 03:09:42 -08:00
.editorconfig test: Add regression test for non-existent env var 2023-11-27 03:09:42 -08:00
.gitignore ignore test/ 2014-06-23 16:08:29 -07:00
.pre-commit-config.yaml pre-commit autoupdate 2023-12-13 15:34:10 -05:00
CONTRIBUTING.md mdformat everything 2022-03-09 11:19:28 -05:00
LICENSE added LICENSE file and appropriate legalese elsewhere 2014-06-02 10:22:48 -07:00
LS_COLORS Merge pull request #216 from ilpianista/feature/rego 2024-08-16 16:44:27 +00:00
lscolors.csh Update shell files 2024-08-16 16:44:40 +00:00
lscolors.sh Update shell files 2024-08-16 16:44:40 +00:00
Makefile Merge branch 'master' into hyperupcall-fix-makefile 2023-12-04 18:13:52 -08:00
README.markdown Add hyperlink to fish shell website 2022-05-03 10:41:07 -04:00
run_tests Add test for duplicates 2020-03-01 18:19:38 -08:00

LS_COLORS

Build

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.

As of this writing, around 300 different filetypes/extensions is supported. That's indeed a lot of extensions, but there's a lot more! Your help is greatly appreciated.

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, 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?

Here's a screenshot (font and minor color shades, of course, depend on terminal and its configuration):

Screenshot1

Dependencies

You need GNU dircolors and a compatible directory listing tool, such as GNU ls. Both are available in GNU coreutils.

Installation

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):

source ~/path/to/lscolors.sh

For C shell or fish shell (e.g. ~/.cshrc or ~/.config/fish/config.fish):

source ~/path/to/lscolors.csh

If you prefer to manually generate these files, an installation script is provided with this repository:

$ mkdir /tmp/LS_COLORS && curl -L https://api.github.com/repos/trapd00r/LS_COLORS/tarball/master | tar xzf - --directory=/tmp/LS_COLORS --strip=1
$ ( 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):
  source "~/.local/share/lscolors.sh"

For C shell (e.g. ~/.cshrc):
  source "~/.local/share/lscolors.csh"
$

Arch Linux

Arch Linux users can install the lscolors-git package from the AUR for easy integration with bash, csh, or zsh.

Information for Developers

There's a library I've written that lets you use various LS COLORS on arbitrary files and directories. A simple implementation can be found here.

Using this, you can do

find $HOME -maxdepth 1  | ls_color

mpc search artist Laleh | ls_color

... and so on.

© Copyright 2014-2022 Magnus Woldrich.

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.