![]() ![]() ![]() The main difference in mine is that it has all 6 picking options (H,S,V,R,G,B) not just Hue. I haven’t seen one that does that and this is a fun way of showing what JavaScript can do. There are a lot of nice JavaScript color pickers out there ( colorjack, colourmod, yahoo, dojo, nogray, mootools), but none of them has a full HSB and RGB options of Photoshop’s picker. Some pickers try to generate the entire color map in JavaScript by drawing a 256×256 grid made of divs. This is very slow, which is why color pickers that go the JavaScript route often don’t draw the entire map, but instead only 4×4 or 8×8 blocks ( ColorZilla). The other options is to use transparent PNGs and opacity to fake the maps. A few years back, I did this, but it didn’t have RGB and was Firefox and IE only ( excellent tutorial here). To create the color mixing, the larger map is made of two layers and the vertical slider has four layers (two are used for H, S, or B four layers for R, G, or B). Some others pickers use this method for a hue map, but don’t include the other maps (S,V,R,G,B). The JavaScript is made up of some color methods, a slider control, a handler for input, and the ColorPicker object to put it all together. It would probably need some modification depending on use, but you can download it here: Color Picker Tested on IE5.5, IE6, IE7, FF2, Opera 9, Safari 2. I previously used colorjack, which is great but full of quirks. I really like how you used tables unlike all the standardistas out there that think tables are "wrong." This colorpicker is the best I’ve seen so far.įor one thing, it used common variable names which step all over other libraries and my own code and is insanely CSS oriented, so trying to change its layout is a huge pain that’s basically hours of trial an error. ![]() The one thing that bothers me is the difficulty in writing a colorpicker that can "start" on any color. I foresee this as quite a task, maybe a fun challenge. For instance, you set you colorpicker to start on #FF0000 and you set the background to red as well. If I wanted it to start on a custom color, like one that was in a database for instance, maybe #0000FF, the color box would be correct but the background of the picker would be red, or maybe white. Basically, you’d need an algorithym to detect what each color’s background would be (the reverse of how it normally works). We don’t have the correct color in the slider. updateSliderVisuals The selected color differ from the color showed in the slider. setColorMode tAlpha(this._barL1, (vertPerRev>horzPerRev) ? horzPerRev : vertPerRev) įor( var i = 0, ni = a.length i horzPer) ? horzPer : vertPerRev) tAlpha(this._bar元, (vertPer>horzPer) ? horzPer : vertPer) tAlpha(this._barL4, (vertPer>horzPerRev) ? horzPerRev : vertPer) UPGRADE TO DO ( tested ) in "ColorPicker.js"įunction. Thanks for this: it’s nicely coded, and is saving me huge amounts of wheel reinvention. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |