Archive for June, 2006

June 21st 2006

Unique but “Similar” Colors

I just needed to generate a variable list of unique colors, but they also need to work together. IE, I don’t want a hot pink and a pastel yellow, because although they would be a drastically different, they would look odd together. Rather than hard-code it, I thought about it a minute and decided to try it this way.

A popular way to represent colors is HSV, which stands for Hue, Saturation, and Value. Hue is the actual color on the spectrum (or loosely put, Rainbow). Saturation is the intensity of that color. Finally, value is the brightness of that color.

Given a color with the same Saturation and Value but differing Hues, the only difference will be the color itself. If the saturation and value are the same, the colors would also “match” visually.

So, here’s the method I wrote:

Function UniqueColor( index As Integer, colorCount As Integer ) As Color
Return HSV( index / colorCount, .4, .6 )
End Function

I can call this function in a loop to generate a list of colors. An example output would be this list of 5 colors:

  • Color 1
  • Color 2
  • Color 3
  • Color 4
  • Color 5

Enjoy!

2 Comments »

June 9th 2006

Fun Times

So, where was that update I promised? Well, it’s somewhere ;)

I’ve been hard at work on many things. Thankfully, I’ve had five separate paying projects outside of work, of which only minor fixes remain on all of them. The bad news is that only one of the checks has arrived so far, so I can’t wait for next week when the rest should come in :)

My evenings and weekends have been either been occupied with that, or occupied with me trying to relax some of the time. I couldn’t keep that type of work up for too long, but it’s sure motivating to take a break and think about planning another part of the honeymoon, or the “second honeymoon” (I’m taking Erin with me to San Francisco for WWDC two weeks after the honeymoon, and we’re spending the weekend before out there as well).

Speaking of WWDC, are any readers or REALbasic users going? If so, we should try to get together at some point during it. Perhaps for a dinner on one of the nights with no events planned (I haven’t looked at the schedule yet, so I don’t know which nights are open). If you’re going to be at WWDC or simply around San Francisco during that timeframe and are interested in doing something, leave a comment with a valid email, and I’ll followup next month sometime.

To add to all the fun times I’ve been having this past month, some guy hit me from behind when I was stopped at a stoplight on the way to work Tuesday morning. I drive a little red Kia Rio, and got hit by a huge white Ford Excursion, which pushed me into a huge blue GMC Yukon. Needless to say, my car stood no chance, and their vehicles had essentially mere scratches. Hopefully that will be fully resolved next week. My neck is finally feeling better. I was worried that, although it was a low speed accident, something was seriously wrong because by Wednesday morning I could barely move without being in pain. But, tonight it’s feeling pretty good — still a little stiff, but nearly no pain.

As to the algorithm problem, I still want to post one. Thomas sent me an interesting idea for one that I haven’t really had a chance to let percolate, but I also have a few ideas of my own. I’ll try to get around to posting one soon. In the meantime, be on the lookout for a new REALbasic plugin that I’m sure a lot of people will be pleased to incorporate into their products. It’s been fun to work on it, and while it still has a ways to go, I’m gearing up for the first alpha preview of it.

2 Comments »