21 Mar 2017
It's been a while since my last post. I had been a bit troubled by the pace of things happening in life. Anyways I'm back and well ... Happy new year!
Now that we've got that out of the way, let's start colorising our
This write up is a list of things, that make me happy at the command-line. It basically covers
programs, with a lil' bit of shell-fu, that spit way more colors than they should.
But hey, it's uber cool than just a green terminal.
Inorder to have "full color", our terminal emulator should support it.
I use xfce4-terminal as my terminal.
And in my
$SHELL's rc file (usually the most common
I would add a line that goes export
TERM="xterm-256color". I also from time to time
use tmux which
is a terminal multiplexer. The following
snippet should be added to the top of
$HOME/.tmux.conf for a seamless colorful terminal experience.
## yeah! moar color support set -g default-terminal "screen-256color" # doesn't hurt if utf support is enabled :) set -g utf8 set-window-option -g utf8 on
Colors to shell scripts
In my $SHELL's rc file, I'd assign a set of colors to a set of variables. And then use those
variables whenever I want to display certain text in color.
This is a snippet from my
# text normal colors red='\e[0;31m' blue='\e[0;34m' cyan='\e[0;36m' green='\e[0;32m' yellow='\e[0;33m' # text bright colors bred='\e[0;91m' bblue='\e[0;94m' bcyan='\e[0;96m' bgreen='\e[0;92m' byellow='\e[0;93m' bwhite='\e[0;97m' # reset color NC='\e[0m'
Now I can use these variables in my
$SHELL session or scripts as per the screenshot below
ls command that we're all familiar with, has a
--color=auto option that gives pretty
sweet colors while listing files and directories. But I want something more like this ...
Head over to the project's git page and install it.
I usually put a
alias ls="ls++" in my
$SHELL's rc file. Do note that the program uses a config file,
as mentioned in the project's github page. We can also specify custom colors for each
dircolors. Put a custom
.dircolors file in our
Then add a few lines in
$HOME/.bashrc that reads
# color specifics for ls if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" fi
This is the dircolors file that I use.
Zsh syntax highlighting
If you're not into switching shells, you may skip this. But do give zsh a try as
its a beautiful piece of software. I am ashamed to admit it, but this was the first thing that
made me try zsh. Get the project from here. Put it in a safe place and add the
following to our
# syntax highlighting source ~/.config/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh #adjust accordingly ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets) ZSH_HIGHLIGHT_STYLES[default]='none' ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red' ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=yellow' ZSH_HIGHLIGHT_STYLES[alias]='fg=blue' ZSH_HIGHLIGHT_STYLES[builtin]='fg=blue' ZSH_HIGHLIGHT_STYLES[function]='fg=blue' ZSH_HIGHLIGHT_STYLES[command]='fg=blue' ZSH_HIGHLIGHT_STYLES[precommand]='none' ZSH_HIGHLIGHT_STYLES[commandseparator]='none' ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=blue' ZSH_HIGHLIGHT_STYLES[path]='none' ZSH_HIGHLIGHT_STYLES[path_prefix]='none' ZSH_HIGHLIGHT_STYLES[path_approx]='fg=yellow' ZSH_HIGHLIGHT_STYLES[globbing]='fg=green' ZSH_HIGHLIGHT_STYLES[history-expansion]='fg=green' ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='fg=magenta' ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='fg=red' ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='none' ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='fg=yellow' ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow' ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='fg=cyan' ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='fg=cyan' ZSH_HIGHLIGHT_STYLES[assign]='none'
Lolcat is our friend cat with rainbow puking powers.
sudo apt install lolcat and we'll end up with something like ...
The man page has a bit more info on what we can do with lolcat. Do read up and enjoy happiness.
This is also a colorizer program like lolcat. Install it with
sudo apt install grc and then ...
Consult the man pages for more examples.
Our good old filesystem viewer
df plus graphs, bars, colors =
Git it and enjoy.
Ahem!! read the man page?
I know this is only a few things, but I hope you go out and rice your masterpiece. Eye candy is an important part of everything I do. It makes having to look at a screen, a pleasure.
I hope the "one-more-thing-to-rice" bug has bitten you. And oh! if you're into this, drop by at the BBQ.
Have a great day!