A Ruby script that colorizes the ls
output with color and icons.
This package is a third party modified version of athityakumar/colorls. If you are new babies to this command-line tool, consider reading the detailed instructions in the original repo before going ahead.
- 2022-02-23: Update tree view
- 2020-09-05: Add a new feature for customizing the color of different kind of files
- 2020-09-05: Fix the bug which causes failure to colorize and count unrecognized files
git clone https://github.com/jaredyam/colorls.git
cd colorls
# Install ruby >= 2.5.0
sudo add-apt-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get install ruby2.6 ruby2.6-dev
# Install bundler
gem install bundler
bundle install
# Install colorls
gem build colorls
gem install --local *.gem
Suppose you are going to use dark_colors.yaml
as your default color scheme. To customize the filename color of certain extensions you want to highlight:
cd ~/.config/colorls
# Initialize a default color scheme configuration if you don't have it yet.
cp $(dirname $(gem which colorls))/yaml/dark_colors.yaml .
# Open the configuration with your favorite editor
subl dark_colors.yaml
# Set your custom color scheme of filenames of different extensions
py: gold
md: pink
pdf: indianred
...
The following shell aliases and functions are recommended to use together with colorls
:
alias ls="colorls --light --sort-dirs --report --dark"
alias lc='colorls -lA --sd'
function tree() {
if [ "$1" -eq -1 ]; then
colorls --tree
else
colorls --tree="${1:-1}"
fi
}
function cd() {
builtin cd "$1"
tree
}