Thursday, January 06, 2011

Color Picker Field for Sitecore


Here is a late Christmas present for the Sitecore community. A “ColorPicker” custom field that helps storing color codes in Sitecore.

The idea is simple: have a single line text box for color code storage and present the user with a good looking dialog to pick the color.

Technically speaking, there are two ways of color picking implemented.
The first approach is using native Internet Explorer’s color picker dialog and it is getting called via JavaScript.
The second one is using a custom built XamlSharp dialog with a ColorPicker control from ComponentArt. If you are using non IE browsers, the second dialog will be called.

Here is a short video about how it works. Turn those mics on!

Color Picker Module for Sitecore

Here are the installation steps:

1. Download the appropriate Sitecore package.
If you are planning on building the project yourself, use the “ColorPicker field items only” package.

2. Install it via Sitecore desktop.

3. After the installation, new custom field called “Color Picker” should be registered with the system.

To verify it, switch to “core” database and go to the following location: “/sitecore/system/Field types/Simple Types”

The “Color Picker” field should be there and should look like this:

clip_image001

Short user guide:

1. If the installation was successful, you can start using it.

2. Find the template you want to play with.

3. Create a field of type “Color Picker”

image

4. Create an item from this template.

5. Enjoy.

image

This shared source module has been implemented in collaboration with Artem Loboda (compent.dk).

Developed and tested on 6.4 Update-1. Expected to work with 6.3. There could be compatibility issues with earlier releases.

All the sources are published to our Shared Source Library. Thanks for the help, Jimmie :-)
http://trac.sitecore.net/ColorPicker/browser/Trunk

8 comments:

Brian Pedersen said...

That's a very cool new field for Sitecore.

Alex Shyba said...

Thanks Brian!

Dmytro Dzyuma (DixonD) said...

Thank you for this control!;)

Dmytro Dzyuma (DixonD) said...

However I have problems with retrieving the field value from the code. Are there any specifics?;)

Alex Shyba said...

Hi Dmytro,

You should be able to use the conventional approach to retrieving the field value via item.Fields["color"].Value

The module just visualizes the color code and let you set it via a dialog, nothing more.

Dmytro Dzyuma (DixonD) said...

Yes, you are right, it works, of course. It was a kind of stupid mistakes when you are trying to retrieve the value from the language version where the field isn't filled at all =) It happens to me from time to time:(

bryanpatterson said...

I just installed this and it works fine in Chrome and Firefox. I get an error "Sorry, your browser does not support HtmlDlgSafeHelper, please use IE>=6 version." I'm using IE 9 and Sitecore 6.4.1 rev 110720

Александр said...

Good job dude