PDA

View Full Version : Yahoo color picker bug / improvement



sobuj
08-04-2008, 11:23 PM
Hi guys

First of all, thanks for running such a wonderful site.

1) Script Title: Color Picker Widget (YUI based)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex11/ddcolorpicker/

3) Describe problem: Well, I found that we have a few issues that could be corrected / improved on the dhtml widget that opens on clicking the control box.

Problem is, if we click on the hue vertical bar before clicking on the square box of the left, the preview panels do not show any change in color. We "must" click the left square first in order to activate a link between the hue vertical bar and preview panels.

2nd, if we have the input prefilled with a #value, the corresponding color of the control box changes when the page loads. However, that does not get reflected on the dhtml widget. The widget still shows the white color instead of showing the prefilled color.

Also, it would be nice to have a way to change the dimensions (width and height) of the control box changed through css. Now changing through .colorpreview { is not doing anything. Possibly it is getting defined elsewhere.

Do you guys think this can be improved?

Thanks, and once again thanks a lot for supporting the site and this forum. I have myself tried to run a couple of forums, and know what type of dedication such work asks for.

Cheers.

ddadmin
08-05-2008, 05:26 AM
Hi Sobuj:
Nice suggestions, a couple I've thought about already. I do plan on upgrading the YUI color picker, and when that happens, most likely will implement at least a few of the above. Due to time constraints though, I can't say exactly when the script will be updated, as there are quite a few ahead in the lineup.

sobuj
08-05-2008, 09:09 AM
Take your time, admin.

In this regard, in case you haven't seen this yet, I found this while googling for a color picker, http://www.colorpicker.com/

This one doesn't have the problems the yahoo tool has (like, the hue bar is linked to the preview palate right on load and we can specify a color when the page loads, which reflects on the palate), but I am not sure if their code is open sourced (appeared much lighter, only one small js file (13 kb) and that's all).

And then I'm not sure how tough it will be to incorporate that to the dhtml widget (the popup).

thefandango
11-24-2008, 08:50 AM
This is what I am looking for! In the DD color picker the "#" is not inside the target formfield, meaning when you copy and paste you have to add a "#" in front of the hex code. On the link supplied below the "#" is in the target form field along with the code.

How could I change the DD YUI picker so that the "#" symol also appears in the target form field along with the hex code?

Thank you.



Take your time, admin.

In this regard, in case you haven't seen this yet, I found this while googling for a color picker, http://www.colorpicker.com/

This one doesn't have the problems the yahoo tool has (like, the hue bar is linked to the preview palate right on load and we can specify a color when the page loads, which reflects on the palate), but I am not sure if their code is open sourced (appeared much lighter, only one small js file (13 kb) and that's all).

And then I'm not sure how tough it will be to incorporate that to the dhtml widget (the popup).

thefandango
11-24-2008, 09:06 AM
Worked it out - doh!

pickerswatchupdate function:

"#" + YAHOO.util.Color.rgb2hex(a[0], a[1], a[2]);
ddcolorposter.initialize(a[0], a[1], a[2], hexvalue)
}

thefandango
11-24-2008, 11:29 AM
actually that did not work properly :-(

ddadmin
11-25-2008, 08:00 AM
You're pretty close actually. Inside "colorpicker-min.js", add the code in red to the below chunk of code like you already have:


rgb2hex:function(E,D,C){if(B.isArray(E)){return "#"+this.rgb2hex.call(this,E[0],E[1],E[2]);}

Then to prevent double "##" from being shown inside your own form fields, remove the code in orange below inside ddcolorpicker.js:


inputfield.value="#"+colorhex //set input field value to the selected value inside color picker