Color Tools for Silverlight 2

A Silverlight project I am working on required color picker controls – those boxes you find in programs like Paint, Photoshop, and others that allow you to choose a specific RGB color. After doing a little research I wrote two Silverlight user controls, a system color picker that enumerates the available colors from the System.Windows.Media.Colors class properties, and an ‘HSV’ color picker that sports the traditional hue slider, saturation/value box, color swatch, and hex display. You can try out these controls on my ColorTools demo page.

I want to credit the excellent examples by Page Brooks in his article on building a Silverlight color picker. Specifically his rather cool tricks for creating the color gradients using XAML, and his implementation of a ported javascript HSV-to-RGB conversion, which I have more or less cribbed in wholesale fashion. To his basic concept I have added a routine for converting from RGB-to-HSV, in order to allow setting the selected color from code. I have also fleshed out the dependency properties for both controls in order to make them useful. Feel free to download and use these controls in your own applications. Links to source and binaries appear below. There is no documentation yet, mostly because I have just installed Vista and haven’t put Sandcastle back on yet, but the controls are very easy to use, and the demo page shows the basic XAML and C# needed.

ColorTools for Silverlight Runtime
ColorTools for Silverlight Source

2 thoughts on “Color Tools for Silverlight 2

  1. Thanks, Jacques. You might want to check out this post, as I recently released an updated version of this library with some additional controls that you might find useful. Thanks for stopping by.

Leave a Reply

Your email address will not be published. Required fields are marked *