Rainbow 2.0

As my first haxpact entry, I decided to finish up the remaining pieces of rainbow, a toy program I developed that I find useful when doing anything with color (HTML stuff usually).  It’s a Ruby/GTK program that displays hex color codes found in plain text.  Here’s a current screenshot:

It has just been released as Rainbow 2.0.  Go check it out!

Rainbow never had an official 1.0 release, as it was waiting on a bug to be fixed in the Ruby/GTK bindings in order to let drag and drop work.  That bug is long since fixed, but I wanted to improve the visual nature of the program to show colors more proportional to the number of times they occured in the file.  Let’s start back at program inception and show the progression.

rainbow early concept

The rounded corners were adapted from a Python GTK theme color previewer that someone posted on Planet GNOME once (I forget who or where!), and the grid layout is using some seriously sketchy math on my part to lay it out.  This is however a working concept, parsing colors from text input and putting them into the grid.

rainbow 1.0

That grid concept grew more and I eventually surrounded it with some options such as sorting by hue or count, and showing text labels of the hex colors. This was supposed to be released as 1.0, but never quite made it due to waiting for that Ruby/GTK bug to be fixed (as well as general apathy).

I then tried to modernize it by throwing out the grid concept and making the swatches proportional to the number of occurances read in the input, but I really didn’t know how to do that. I stumbled across the “bin packing problem” and tried to adapt it to rainbow, with disastrous results:

binfit

The problem with the bin packing solution is that you need to know the dimensions of the items you are trying to pack, in this case, the colors, and that’s not what I care about here.  I just care about the area the colors take up.

Then I remembered a Windows application that displayed file usage as some sort of divided squares. After some googling, I found it: TreeMap. I adapted some code from the open source Java implementation linked there and used it to form what is rainbow 2.0.  Give it a try!

Post a Comment

Your email is never shared. Required fields are marked *

*
*