meandeviation.com > colourpicker

colour picker

 
Alan Dix
http://www.hcibook.com/alan

This colour picker can be used stand-alone simply to help you choose web colours. If this is what you need simply press choose colour now!

However, it is also designed so that it can be called from your own web applications whenever a colour choice is required.It allows the colour to be specified by hex values or through selection of a web-safe colour from a pallete. The web page for selecting the colour is small enough to fit into a pop-up if necessary.

For a simple example application using the colour picker see colour viewer.

Including the colour picker in your own applications

To use the colour picker you simply include a link in your own web page indicating the page to return to like this.

The code for the link above looks like:

https://meandeviation.com/utils/colourpicker/pick.php?return=
                https%3A%2F%2Fmeandeviation.com%2Futils%2Fcolourpicker%2Findex.php

Notice the url parameter "return=" followed by the (url encoded) url of this page. This tells the colour picker to send its result back to this page. It appends to the url "&colour_chosen=" followed by the colour you chose. Try out the link above and look at the url in the address line. You will of course have to replace this with your own return url. This would normally go back to a script where this gets used as a text colour or something like that.

Additional parameters can be set to customise the colour picker page including setting the default colour (usually the current setting for whatever is going to be edited), text to appear on the page, the title of the page (e.g. "choose the background colour"), etc.

The full list of parameters for the colour picker is given below so that you can conctruct a URL in your own code. Or to get you started you can use a web form to build your own colour picker.

Full list of parameters

title title for the page
mess message displayed on the page
defcolour current/default colour e.g #FF00FF
this will often be set by a script to be the current colour for something
return url to return to when the colour is chosen
this url will have &name=colour added to it
name name of parameter to add to return url
defaults to "colour_chosen"
cancel

url to return to if the user cancels this page
defaults to "return&cancelPick=cancel&name=defcolour"

target target frame for return url
lang language - currently only en - English (default) or us - US English
used to decide whether to use 'colour' or 'color' in messages
... but the name of the application is always colourpicker ;-)

 

 

http://www.meandeviation.com/utils/colourpicker/ Alan Dix © 2001/2005