Complete JavaScript Color Picker
Welcome to the final installation of my JavaScript based Color Picker series. I have made a lot of changes to the color picker since my last installment.
Layout
I found some major problems based on the document type with the way I was laying out elements in the color picker dialog, so I decided that it needed to use the lowest common denominator in order to work reliably, so it is laid out with, *gasp* tables.
Sizing
After adding the support for the Canvas element I decided to add options to size the HueBar and the SV Box.
Options I added the ability to pass in an Options object that gives the ability to customize many parts of the Color Picker.if(this.Options.hueBarWidth){ this.HueBar.setStyle("width", this.Options.hueBarWidth); }else{ this.HueBar.setStyle("width", "30"); } if(this.Options.hueBarHeight){ this.HueBar.setStyle("height", this.Options.hueBarHeight); }else{ this.HueBar.setStyle("height", "360"); }
Open/Close I created Open and Close member functions on the color picker object its self.this.Options = {}; if(objOptions){ this.Options = objOptions; }
You can download the full source from the JavaScript Color Picker project page.open: function (){ this.Container.setStyle("display", "block"); }, close: function (){ this.Container.setStyle("display", "none"); }




















