Безусловно, выиграет линкомаулия yaci.ru!

What is Color Picker?

Color Picker tool is a DHTML application for choosing color for some elements of your page.
The main aims of color tool are color management, creating color schemes, picking colors, and more.
Many such tools exist on the world wide web, and generally feature a color harmonization interface, a color picker,
RGB and HSL conversion and manipulation, a collection of saved schemes, and other similar characteristics.
Web masters, designers, developers, and professionals that work with other types of screen or print media use these tools in their work.

Tool what present on this page is just color picker for online applications like myspace profile editors and so on.

HTML Color Picker uses a reduced size version of Prototype Javascript library, producing a smaller size, extremely functional and fast loading in browser. The total size of the application is about 35KB.

Tool is free for use and distribution and it doesn't require developer permission or approval to use. Feel free to contact me by e-mail address Email Address

Types of HTML Color Picker

Current tool can be present in four types:

Cube color picker Continious color picker Rainbow picker Grayscale picker
cube color picker continuous color picker rainbow color picker grayscale color picker

How can I use DHTML Color Picker Tool?

Usage of javascript color tool is simple. Follow the steps below and enjoy!

Include CSS stylesheets and javascript files into your document and create Picker object whenever after page loading:
1
<link rel="stylesheet" type="text/css" href="/css/cpicker.css" /> <script type="text/javascript" src="/js/prototype_reduced.js"></script> <script type="text/javascript" src="/js/cpicker.js"></script> <script type="text/javascript"> var picker = new ColorPicker(); function onPickerClick(color) { $('stroke_color').style.backgroundColor = color; $('strokecolor').value = color; picker.hide(); } picker.setCallback(onPickerClick); </script>
Call it whenever you need
2
... HTML Document ... <div id="stroke_color" style="background-color:#000000;" onclick="picker.show(this, 'background-color')"></div> <input type="hidden" name="strokecolor" value="#000000" id="strokecolor" /> ... HTML Document ...

Color Picker Methods
API
initialize(options)
Initialization function. Object Constructor Example Creating picker object var Picker = new ColorPicker();

live example | comments | up


show(element, selector, pickerType)
Show color picker beside element Parameter object element HTML element (or its ID) where need to show color picker string selector This parameter point for what style selector need to change color. Can be one of the following: color, border, outline, background. Default value is background string pickerType Type of color picker: cube, continious, rainbow or grayscale Example Show rainbow color picker when click span element <span onclick="picker.show(this, 'color', 'rainbow');"></span>

live example | comments | up


hide()
Hide color picker Example Hide picker when some color was choosed function onPickerClick(color) {
    $('stroke_color').style.backgroundColor = color;
    $('strokecolor').value = color;
    picker.hide();
}
picker.setCallback(onPickerClick);

live example | comments | up


setCallback(callback)
Set callback for color picker Parameter function callback Function what will called when user click some color on the picker Example function onPickerClick(color) {
    $('stroke_color').style.backgroundColor = color;
    $('strokecolor').value = color;
    picker.hide();
}
picker.setCallback(onPickerClick);

live example | comments | up

 

Download DHTML Color Picker Tool

Download the full package of DHTML Color Picker. Please send me your feedback on this tool.
You can leave any comments you have below on the comment area. Thank you.

DHTML Color Picker Example

Change text background color: click to change

See live example on myspace glitter text generator

 

Users comments about Color Picker

1. Benjamin (Jun, 22 2008 at 11:39 AM)


Amazing script! I have it working beautifully, but I need 5 color selectors on my webpage. How can I set this up to use it on 5 separate instances?

2. Sergey Koksharov (Jun, 26 2008 at 12:32 AM)


Hi Benjamin!
Thanks for your comment. I've sent solution to your email address. Will fix my picker soon and upload updates in public.

Regards,
Sergey

3. Steve (Jun, 26 2008 at 10:37 PM)


Sergey,
Can you also send me the solution for multiple instances on the same page? Looks great!

Thanks,
Steve

4. Blair (Jun, 27 2008 at 06:31 AM)


I'd also love to know how to use this several times in one page - great script so far, I love it =)

5. Cosmin (Jun, 30 2008 at 01:42 AM)


This is one solution that i found for multiple instances on the same page. I hope it helps.

Thanks.


var picker = new ColorPicker();
var tag = 'custom_color';
function onPickerClick(color) {
$('picker_'+tag).style.backgroundColor = color;
$(tag).value = color;
picker.hide();
}
picker.setCallback(onPickerClick);


change


change


change

6. Cosmin (Jun, 30 2008 at 01:50 AM)


Sorry for the previous post. So .. here it is again


var picker = new ColorPicker();
var tag = 'custom_color';
function onPickerClick(color) {
$('picker_'+tag).style.backgroundColor = color;
$(tag).value = color;
picker.hide();
}
picker.setCallback(onPickerClick);


change


change


change

7. argyris (Jul, 02 2008 at 12:13 PM)


are you kidding us? the last two posts are exactly the same , anyway something wrong with this color picker, can you put a full working example anywhere please?

8. Chris (Jul, 15 2008 at 02:53 AM)


Could you please post an sample HTML file with the full package download?

9. Paul S (Sep, 06 2008 at 09:16 PM)


I tried using multiples ones how you said and it doesn't seem to work. Did you actually try it?

10. Shawn (Dec, 03 2008 at 04:24 AM)


Great script!

Here's my solution for having multiple color pickers on one page. Let me know what you think. (It works for me!)

Update cpicker.js

After landing: null, (around line 8)
Add caller: null,

Change these three lines...
show: function(element, selector, pickerType) {
var element = $(element);
var landing = $(this.options.pickerID);

To be these four lines...
show: function(elementin, selector, pickerType) {
var element = $(elementin);
var landing = $(this.options.pickerID);
this.caller=elementin;

Around line 345 change

this.callback(this.textValue.innerHTML);

To to be

this.callback(this.textValue.innerHTML, this.caller);


In your html page...
Add div tags for picking colors




Lastly, use call back function like


var picker = new ColorPicker();
function onPickerClick(color, caller) {
if (caller=='colorselector') {
$('colorselector').style.backgroundColor = color;
$('color_selector').value = color;
}
else if (caller=='framecolorselector') {
$('framecolorselector').style.borderColor = color;
$('frame_color_selector').value = color;
}
picker.hide();
}

picker.setCallback(onPickerClick);

11. Shawn (Dec, 03 2008 at 04:28 AM)


Here's the div tags for the above post...(hopefully)


<div class="backgroundcolorselect" id="colorselector" onclick="picker.show('colorselector', 'background')"></div>

<div class="framecolorselect" id="framecolorselector" onclick="picker.show('framecolorselector', 'border')"></div>

12. Martijn (Dec, 11 2008 at 11:48 AM)


Exactly what I was looking for! Thanks a lot!

Shawn, same for you! Works perfectly! Thanks!

13. Sean W (Dec, 19 2008 at 05:53 PM)


Very nice color picker! However, it contains a notable bug:

On the continuous and cube view, the colors on the left side (grey shades, red, green, blue, yellow, etc) turn up as various shades of red, which is obviously incorrect.

It would be great if it were fixed. I am going to try and create a workaround for my implementation.

Thanks!

14. Sean Weeks (Dec, 19 2008 at 07:24 PM)


The fixed colors bug above lies in a problem in the regex in the RGB: function. Instead of fixing the regex, I changed the fixed values to the "rgb(r,g,b)" form and adjusted line that creates the fixed value pixels to:

var pixel = this.getPixel(((i - 1) % 3 == 0) ? this.fixed_values[Math.round((i - 2) / 3)] : 'rgb(0,0,0)');

15. Pratic Sharma (Dec, 28 2008 at 08:12 AM)


I tried to run your code. I think prototype_reduced.js file is missing in the full package.

16. Bill E (Jan, 09 2009 at 08:31 PM)


hey Sean, thanks for the fix. The only thing I ask is could you explain in more detail what to replace/how to fix it for morons like me? :)

I'd appreciate it

Thanks

17. Chris Bowyer (Jan, 21 2009 at 03:45 PM)


Great looking picker! Terrible instructions. Missing file in download.

18. Francois Chapdelaine (Feb, 16 2009 at 07:10 PM)


*Bug:

If we change the zoom of the page with ctrl + mousescroll,

we get a weird display when we open the colorpicker.

19. temesegan shumetu (Mar, 01 2009 at 02:38 PM)


send by may address moor attract color

20. darkslave (Jun, 01 2009 at 01:05 PM)


2 Sergey Koksharov
а есть ли решение color picker'а использующее jquery а не prototype?

21. Jacsoft (Aug, 09 2009 at 10:19 PM)


It does not work in Internet Explorer. That is too bad, otherwise it would be a nice picker. Now I will choose an other one.

22. Christophe (Sep, 23 2009 at 01:41 PM)


Someone can help me.... i have download the full package and i am trying to implement it but it doesn't work...

thx... my code










var picker = new ColorPicker();
function onPickerClick(color)
{
$('stroke_color').style.backgroundColor = color;
$('strokecolor').value = color;
picker.hide();
}
picker.setCallback(onPickerClick);






Change

23. christophe (Sep, 23 2009 at 01:45 PM)


var picker = new ColorPicker();
function onPickerClick(color)
{
$('stroke_color').style.backgroundColor = color;
$('strokecolor').value = color;
picker.hide();
}
picker.setCallback(onPickerClick);




//

Change




here my all code..it doesn't work

24. DancArt (Mar, 31 2010 at 06:45 AM)


31.03.2010

Color Picker blocked by Avast Antivirus as being malware.
I sent them a false positive report.


 

Leave your comment