Skip to content

A Ruby gem that beautifies the terminal's ls command, with color and font-awesome icons. 🎉

License

Notifications You must be signed in to change notification settings

jaredyam/colorls

 
 

Repository files navigation

Color LS

forthebadge forthebadge

Gem Version CI PRs Welcome

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.

What’s NEW?

  • 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

Installation

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

Customization

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
...

Aliases and functions

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
}

About

A Ruby gem that beautifies the terminal's ls command, with color and font-awesome icons. 🎉

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 99.6%
  • Shell 0.4%