LsColors
<img src=“inch-ci.org/github/Winterbraid/lscolors_ruby.svg?branch=master” alt=“Inline docs” /> <img src=“codeclimate.com/github/Winterbraid/lscolors_ruby/badges/gpa.svg” />
Allows loading color definitions from JSON, previewing, and printing a LS_COLORS compatible config string.
To use the configuration, do the following in your terminal:
export LS_COLORS=`ruby -rlscolors -e 'print LsColors'`
You will probably want to add the above line to your shell’s rc file.
By default, LsColors will try to load a file called .lscolors_ruby.rc from the user’s home directory. That file can also be created by running LsColors.save without any parameters.
Example use
# Output the LS_COLORS configuration string
LsColors.to_s
# Preview the current settings
puts LsColors.preview
# Save the settings to a file
LsColors.save 'test.json'
# Display all available colors and their numbers
puts LsColors.test
Troubleshooting
LsColors assumes a 256-color compatible terminal. Use the following code to test your terminal’s capability (this can also help you get color numbers):
puts LsColors.test
If your terminal does not seem to support 256 colors, try adding the following line to your shell’s rc file:
export TERM=xterm-256color
If you are looking for a good graphic terminal emulator, try Terminator. If the colors do not seem to display correctly in screen, refer to this guide or try Tmux, which can do all screen can and more.