

Grc - it's like stylesheets for your terminal - netherland
http://wynnnetherland.com/journal/a-stylesheet-author-s-guide-to-terminal-colors

======
kibwen
_Solarized provides a great mapping table between terminal color names and
various color spaces._

Have to disagree slightly with this. Solarized is a great starting point, but,
last time I checked, using the provided mapping table leads bold green, bold
blue, and (most importantly) nonbold white to all become nearly-
indistinguishable shades of grey. This alone damages the utility of the
normally-colorized output of `ls`, as well as any tools that expect bold and
nonbold versions of the same color to be roughly the same hue.

If you can stand losing Solarized's ability to swap back and forth between
light and dark modes, I highly recommend tweaking it to your needs rather then
relying on the default.

~~~
zdw
Similar problem here - I tried Solarized for a while and found that it was too
low contrast for my tastes.

I switched to Tim Pope's vividchalk.vim and have been quite happy ever since:

<https://github.com/tpope/vim-vividchalk>

------
pmr_
I use different .Xdefaults for my shell "styling" and are incredibly happy
with it. Changing to another theme is just one xrdb -merge away.

~~~
gcb
this goes a little further i guess. you can add color to regexp matches for
command outputs.

~~~
pmr_
Apparently. Judging from what it does the implementation could be a nice
example of layering shell tools on top of each other to get new functionality.
Probably it has some uses for people that work entirely with the shell.

------
bitwize
Meh. Because I'm a Real Man with Real Big Balls I still think terminal text
should come in one of three colors: green, amber, and page white. And you
choose the color when you buy the terminal.

Kidding aside, I do do all my coding in an xterm that's had the font set to
Glass Tty VT220 and the color set to one of those. Text decoration for
highlighting purposes is done with our old friends bold, underline, and
reverse video. But I'm retro like that.

~~~
aMoniker
You are so cool. How can I be cool like you are cool?

~~~
unimpressive
echo -e '\033[0;32m'

EDIT: Of course, real hackers use a rainbow shell prompt.
(<http://www.termsys.demon.co.uk/vtansi.htm>) Building one of these is left as
an exercise for the reader.

------
liyanchang
Essentially running a regex and applying colors. Very cool for simple
applications.

Given how difficult regexs are to write properly, this probably doesn't scale
well. Sadly, there isn't a DOM for terminal applications.

------
iopuy
Over the years this has been a hobby of mine to colorize the shell on Linux or
at least make it easier on my eyes. The best results I've had relied on the
following features:

    
    
        1. Screen. Screen allowed me to colorize the hardstatusline at the bottom of the page. You can also set the hardstatus line so it updates to show the open application. Watch the video at the bottom of the screen and when I open Vim and how it updates the tab name on the hardstatus line.
    
        2. Using zsh. Zsh allows you to set the right hand prompt and its color.
    
        3. Using Xterm. Xterm allow me to launch it with any parameters controlling font, background color, foreground color, font size etc. The font I found that work the best was "Liberation Mono".
    
        4. Colorize the prompt. Pretty standard.
    

HEre is a video making use of all these features except for zsh. This was back
when I used bash.

<http://www.youtube.com/watch?v=u5_44vs1WvY>

~~~
Nick_C
Thanks. Actually, that video is about cut-n-paste. The michaelkelleher.info
site mentioned in the video no longer works. Do you have an updated one?

------
petercooper
I'm sure someone here will know the answer for this off the top of their head
so.. how does this work under the hood? How does it get to act as a sort of
'filter' for stdout?

I've recently seen a system that can 'record' your terminal session for replay
on the Web - <http://ascii.io/> \- whose 'recorder' forks off a psuedo
terminal for this ([https://github.com/sickill/ascii.io-
cli/blob/master/bin/asci...](https://github.com/sickill/ascii.io-
cli/blob/master/bin/asciiio.py)). Would something like Grc use a similar
approach or is there another way?

~~~
moonboots
This script inserts terminal escape sequences into text. These sequences are
just text that the terminal interpret as color transitions.

Ascii.io transforms these terminal escape sequences into html/css, so Grc
should work fine with it.

~~~
petercooper
_This script inserts terminal escape sequences into text._

I understand that part. But there's a screenshot where a "ping" is being done
at a normal looking terminal and it just works without being explicitly piped
through a program that does the above. What's the mechanism for piping all the
terminal output through another process?

~~~
moonboots
The initial grc command aliases commands like 'ping' to a modified command
that processes the output[1].

[1]
[https://github.com/mxcl/homebrew/blob/7bbe7e9311ce95a141bf5f...](https://github.com/mxcl/homebrew/blob/7bbe7e9311ce95a141bf5f77ca7fa02d43387748/Library/Formula/grc.rb#L25)

~~~
petercooper
Ahh, aliases. Thanks :-) Makes sense. I was probably dreaming of a world where
it'd pick up an IP address by regex in _any_ terminal output.

------
zobzu
I don't give a rat ass for over coloring stuff in the terminal. I like when
only what helps readability is colored.

But then again I do like _some_ fancy stuff. And I noticed the author uses a
unicode char in his prompt. While it breaks the \$ functionality ($|#) it
looks neat, and I didn't think of that.

pretty cool export PS1="\u@\h \w ʎ"

~~~
zobzu
for the record he uses \u26A1 aka high voltage sign ;-)

------
swah
We start by assuming everyone uses OSX.

~~~
netherland
> Install via your favorite package manager. I'm on OS X so I use Homebrew:

~~~
rurounijones
In fairness I just installed grc on ubuntu and it is nothing like demonstrated
on the blog because the homebrew version has extra stuff in it.

So "Start by assuming OSX" isn't THAT much of a smarmy reply.

~~~
lloeki
> because the homebrew version has extra stuff in it.

Lies! _brew edit grc_ shows that it's just plain grc 1.4.

~~~
zellux
At least the installation script adds some aliases to .bashrc.

[https://github.com/mxcl/homebrew/blob/master/Library/Formula...](https://github.com/mxcl/homebrew/blob/master/Library/Formula/grc.rb)

~~~
lloeki
It _suggests_ to, via you voluntarily typing

    
    
        echo 'source "`brew --prefix grc`/etc/grc.bashrc"' >> ~/.bashrc

------
robbles
This is interesting - I actually wrote a tool very similar to Grc a while
back:

<http://pypi.python.org/pypi/rad>

It uses the same idea of config files specifying what regexes to look for and
how to color them. This tools looks a little more full-featured and tested
though.

Also, I only thought of applying it to highlighting log files. I didn't think
of using aliases to improve the appearance of regular terminal commands.

------
sepposade
Note that if you're an Emacs user and you execute commands from inside Emacs,
there is already a framework for colorization in the fontify-* or highlight-*
functions.

------
xs
Netherland - I installed this and gave it a try. I'm running into one major
issue. I can't see my prompt (or the last line in whatever I'm doing). I don't
mess around and invoke grc by doing 'grc bash'. This now listens for every
command that's in the config file. Well the command I want to work most of all
is ssh. When I ssh into another system I don't see my prompt. Any ideas what I
can do to fix this?

------
pstadler
If you're using Terminal.app, the first thing you should do is installing an
eye-friendly color theme. Check out Optometrist:
<https://github.com/pstadler/optometrist>

------
mise
Does anyone have trouble with tmux displaying colours?

I tried a custom git log query that coloured the custom ordered responses.
Rather than showing the text in colour, there were inline codes being
displayed.

~~~
dmit
Does it work ok without tmux? If not, does git print directly to the terminal,
or does it pipe to another program (like a pager)? Most programs make an
isatty check in this case, but if you force printing of escape codes and pipe
the output to _less_ for example, you'll see the codes in the output instead
of their effects.

~~~
mise
Actually, I think you're right, I probably was piping to less at the time
(which tmux makes me do more of than usual).

------
olalonde
I misread the title "it's like _cheat_ sheets for your terminal" and now I
can't help wondering if such thing exists. I know there is _man_ but it
doesn't exactly have a cheatsheet format. Anyone?

~~~
matthewsnyder
You're probably looking for cheat. <http://cheat.errtheblog.com/>

