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.

	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");
	}

Options I added the ability to pass in an Options object that gives the ability to customize many parts of the Color Picker.

	this.Options = {};
	if(objOptions){
		this.Options = objOptions;
	}

Open/Close I created Open and Close member functions on the color picker object its self.

	open: function (){
		this.Container.setStyle("display", "block");
	},
	close: function (){
		this.Container.setStyle("display", "none");
	}

You can download the full source from the JavaScript Color Picker project page.
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • DZone
  • StumbleUpon
  • del.icio.us
  • Reddit
  • Technorati
  • Netvouz
  • Slashdot
  • blinkbits
  • blogmarks
  • Furl

This entry was posted on Sunday, April 1st, 2007 at 2:16 pm and is filed under JavaScript, MooTools, Color, Object Oriented, FireFox, IE, Canvas Element, Color Picker. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Be the first to leave a comment.

Leave a Reply

You must be logged in to post a comment.

Bad Behavior has blocked 221 access attempts in the last 7 days.