Generate color configurations for Xdefaults and the Linux terminal easily.
Python
Latest commit 55fb972 Jun 17, 2013 @jwcxz use the correct screenshot
Permalink
Failed to load latest commit information.
LICENSE.txt Add MIT license Jun 17, 2013
README.md
example.svg
extract-colors.py The rest of the world uses python, not python2 Jun 17, 2013
show-colors.py

README.md

Color Control

Here are a few utilities for dealing with terminal colors. I started writing them because I was bored on a plane flight. I wanted a way to easily design color palettes and since I didn't have access to the internet, I couldn't get to the 4bit designer, which is also a great tool.

screenshot

Extracting colors from an SVG graphic palette.

extract-colors.py reads colors data from an SVG file and produces lines for your ~/.Xdefaults or Linux terminal color configuration escape codes.

It's not very smart... It doesn't use proper XML parsing at all, just some regular expressions that are fairly robust. See the provided example.svg file for a base to work from.

To generate lines for your ~/.Xdefaults, try:

$ extract-colors.py -t xdefaults example.svg

This will output the appropriate lines.

If you use TTYs directly and would like to generate escape codes for configuring the color palette there, try:

$ extract-colors.py -t linuxterm example.svg

You can then throw those anywhere you want, e.g. in your ~/.{bash,zsh,whatever}rc. I recommend something like this:

if [ "$TERM" = "linux" ]; then
    # borrowed from http://code.google.com/p/fbterm/
    # output of extract-colors.py here
    clear # for background artifacting
fi

Showing the current terminal scheme.

show-colors.py is yet another utility to display your available palette. It's pretty self explanatory. Just run it.