new ng.ColorPicker (Object options) vs. 1.1.2 Full+Lite

An advance color picker that handles RGB, HSL, and Hexadecimal values (in Full version). It provides a dual interface of color swatches for quick selection and a Photoshop like picker for complete control over the color selection.

Features

  • Quick and Easy to use and implement.
  • Full control over the color swatches and to show or hide the advance sliders.
  • Complete with events to allow interactive user selection.

Parameters

Object options vs. 1.1.2 Full+Lite
An optional object that holds the Color Picker properties.

Examples

Creating a Color Picker
Demo:
Color Picker:

Color Picker with Opacity:

Swatches only picker:
In the Lite version or if the ng.Slider is not avaliable, the picker will look like this
HTML5 Style:

Inheritance Tree

This class inherits the following classes and all their methods and properties. It's recommended to check if any private properties/options are defined before using them. The complete list of inheritted methods and events are listed below the current object Custom Events.
ng.Events ()
ng.PlugIn (options)
ng.Component (options)
ng.ColorPicker (options)

Methods

Function ng.ColorPicker.select_color (color) vs. 1.1.2 Full+Lite
Select the passed color. This method will fire the onSelect and onColorChange events.
Function ng.ColorPicker.unselect_color () vs. 1.1.2 Full+Lite
Unselect the current selected color. This method will fire the onUnSelect event and the unselected color will be passed to the event function.
Function ng.ColorPicker.get_value () vs. 1.1.2 Full+Lite
Get the current selected value.
Function ng.ColorPicker.set_current_color (color) vs. 1.1.2 Full+Lite
Sets the current color. This is the color that will show as "new" in the slider section of the color picker before the user change any value.
Function ng.ColorPicker.get_current_color () vs. 1.1.2 Full+Lite
Gets the current color.
Function ng.ColorPicker.set_previous_color (color) vs. 1.1.2 Full+Lite
Sets the previous color. This is the color that will show as "current" in the slider section of the color picker.
Function ng.ColorPicker.get_previous_color () vs. 1.1.2 Full+Lite
Gets the previous color.
Function ng.ColorPicker.set_standard_colors (colors) vs. 1.1.2 Full+Lite
Sets the color swatches.
Function ng.ColorPicker.get_standard_colors () vs. 1.1.2 Full+Lite
Gets the color swatches array.
Function ng.ColorPicker.set_close_on_select (close_on_select) vs. 1.1.2 Full+Lite
Sets the close on select property.
Function ng.ColorPicker.get_close_on_select () vs. 1.1.2 Full+Lite
Gets the close on select property.
Function ng.ColorPicker.set_opacity (opacity) vs. 1.1.4 Full+Lite
Sets the opacity option to true or false. True will allow the user to select the color opacity. This method does not set the color opacity. The color opacity is set by the selected color.
Function ng.ColorPicker.get_opacity () vs. 1.1.4 Full+Lite
Gets the opacity option of the color picker.

Custom Events

In the events' functions, the this will refer to the class object.
Event onSelect vs. 1.1.2 Full+Lite
Fires when the user selects a color.
Event onUnSelect vs. 1.1.2 Full+Lite
Fires when the user unselects a color by selecting a different color. The unselected color will be passed to the function of this event as a variable.
Event onColorChange vs. 1.1.2 Full+Lite
Fires when the user change the current display color by moving the slides or the changing the input fields. This method will also be fired when the user select a color.

ng.Events () Methods

Some of these methods might be overriden by the inheriting class.
Function ng.Events.add_event (evt, func) vs. 1.1.0 Full+Lite
The add_event method will attach an event listener to an object. When the event is fired, the listeners functions will be executed on last added first run approach.
Function ng.Events.add_events (obj) vs. 1.1.0 Full+Lite
This method works the same way as Events.add_event(evt, func) except it takes an object with a list of events and functions.
Function ng.Events.remove_event (evt, func) vs. 1.1.0 Full+Lite
Remove the function func from the event evt queue. When adding the event, you should add the function by reference. Anonymous functions cannot be removed.
Function ng.Events.remove_events (obj) vs. 1.1.0 Full+Lite
This method works the same way as Events.remove_event(evt, func) except it takes an object with a list of events and functions.
Function ng.Events.clear_events (evt) vs. 1.1.0 Full+Lite
Remove all the functions under the event name evt.
Function ng.Events.clear_all_events () vs. 1.1.0 Full+Lite
This function works the same way Events.clear_events(evt) except it removes all the events attached to the object.
Function ng.Events.fire_event (evt_nm, args, evt) vs. 1.1.0 Full+Lite
Executes all the functions in the event evt_nm queue. Functions are executed in lasted added first exectued order.

ng.PlugIn (options) Methods

Some of these methods might be overriden by the inheriting class.
Function ng.PlugIn.get_position () vs. 1.1.0 Full+Lite
Get the plugin holding object position.
Function ng.PlugIn.get_width () vs. 1.1.0 Full+Lite
Get the ng.PlugIn holding object width.
Function ng.PlugIn.get_heigh () vs. 1.1.0 Full+Lite
Get the ng.PlugIn holding object height.
Function ng.PlugIn.set_object (obj) vs. 1.1.0 Full+Lite
Sets the ng.PlugIn holding HTML Element. The HTML Element should hold all the output and handles any events.
Function ng.PlugIn.get_object () vs. 1.1.0 Full+Lite
Gets the HTML Elements that holds the ng.PlugIn output.
Function ng.PlugIn.make_id (txt) vs. 1.1.0 Full+Lite
Creates a unique id for the ng.PlugIn object.
Function ng.PlugIn.get_id () vs. 1.1.0 Full+Lite
Get's the plugin ID.
Function ng.PlugIn.set_language (lang) vs. 1.1.0 Full+Lite
Sets the plugin language and reset the HTML Element direction based on the language.
Function ng.PlugIn.get_language () vs. 1.1.0 Full+Lite
Gets the plugin language.
Function ng.PlugIn.remove () vs. 1.1.0 Full+Lite
Removes the plugin and all it's properties. This method will also remove any HTML Elements that are associated with the plugin.
Function ng.PlugIn.create_options (options, default) vs. 1.1.2 Full+Lite
Create the initial options for the plugin. This method doesn not alter the plugin variables, but return an object that can be assigned to a variable in the plugin.
Function ng.PlugIn.create_events () vs. 1.1.2 Full+Lite
Create the plugin events from the customized option. This method should be called after ng.PlugIn.create_options.
Function ng.PlugIn.get (prop) vs. 1.2.2 Full+Lite
Gets the plugin property. This method will check if there is a getter function for the plugin and return it's value, otherwise it'll return the raw property. This method is useful for getting custom properties.
Function ng.PlugIn.set (prop, value) vs. 1.2.2 Full+Lite
Sets the plugin property. This method will check if there is a setter method for the plugin and call it. Otherwise, it will set the raw property value.This method is useful for setting custom properties.

ng.Component (options) Methods

Some of these methods might be overriden by the inheriting class.
Function ng.Component.set () vs. 1.1.0 Full+Lite
Sets the ng.Component default values and prepare it's HTML structure.
Function ng.Component.set_parent (parent) vs. 1.1.0 Full+Lite
Sets the ng.Component parent object. This allows for nested components.
Function ng.Component.get_parent () vs. 1.1.0 Full+Lite
Gets the parent component.
Function ng.Component.get_parents_components () vs. 1.1.0 Full+Lite
Gets an array of all the component parents.
Function ng.Component.get_children_components () vs. 1.1.0 Full+Lite
Gets an array of all the children components.
Function ng.Component.set_html (html, append, eval_script) vs. 1.1.0 Full+Lite
Sets the component HTML code. Review ng.Element.set_html for more details.
Function ng.Component.get_html () vs. 1.1.0 Full+Lite
Gets the component HTML code.
Function ng.Component.open () vs. 1.1.0 Full+Lite
Opens the component and fires the onOpen event.
Function ng.Component.close () vs. 1.1.0 Full+Lite
Closes the component and fires the onClose event.
Function ng.Component.toggle () vs. 1.1.0 Full+Lite
Opens or closes the component.
Function ng.Component.reposition (obj) vs. 1.1.0 Full+Lite
Reposition the component based on the object position. This method is useful when the placement is the opposite to the language direction and the content changes regularly when the component is open.
Function ng.Component.get_content_div () vs. 1.2.0 Full+Lite
Get the div HTML Element that holds the component content.
Function ng.Component.set_button_ui_class () vs. 1.2.0 Full+Lite
Set the button UI CSS class name option.
Function ng.Component.get_button_ui_class () vs. 1.2.0 Full+Lite
Gets the buttons UI CSS class name.
Function ng.Component.is_open () vs. 1.1.0 Full+Lite
Checks if the component is open.
Function ng.Component.is_close () vs. 1.1.0 Full+Lite
Checks if the component is closed.
Function ng.Component.disable () vs. 1.1.0 Full+Lite
Disables the component and any associated buttons and input field. This method will first the onDisable event.
Function ng.Component.enable () vs. 1.1.0 Full+Lite
Enables the component and any associated buttons and input field. This method will fires the onEnable event.
Function ng.Component.is_enabled () vs. 1.1.0 Full+Lite
Checks if the component is enabled.
Function ng.Component.is_disabled () vs. 1.1.0 Full+Lite
Checks if the component is disabled.
Function ng.Component.set_input (object) vs. 1.1.0 Full+Lite
Sets the component input field. If the component already has an input set, it will remove the events from the original input field.
Function ng.Component.get_input () vs. 1.1.0 Full+Lite
Gets the input field for the component.
Function ng.Component.set_button (btn) vs. 1.1.0 Full+Lite
Sets the component button. When the ng.[NG[Link=Button]Button is clicked, it will toggle the component.
Function ng.Component.get_button () vs. 1.1.0 Full+Lite
Gets the components button.
Function ng.Component.set_placement (placement) vs. 1.1.0 Full+Lite
Sets the component placement.
Function ng.Component.get_placement () vs. 1.1.0 Full+Lite
Gets the component's placement.
Function ng.Component.set_offset (offset) vs. 1.1.0 Full+Lite
Sets the component's offset.
Function ng.Component.get_offset () vs. 1.1.0 Full+Lite
Gets the component's offset.
Function ng.Component.set_visible (visible) vs. 1.1.0 Full+Lite
Sets the component's visibility.
Function ng.Component.get_visible () vs. 1.1.0 Full+Lite
Gets the component visibility.
Function ng.Component.set_open_onfocus (open_focus) vs. 1.1.0 Full+Lite
Sets the component open_onfocus property.
Function ng.Component.get_open_onfocus () vs. 1.1.0 Full+Lite
Gets the component open_onfocus property.
Function ng.Component.set_open_onclick (open_click) vs. 1.1.0 Full+Lite
Sets the component open_onclick property.
Function ng.Component.get_open_onclick () vs. 1.1.0 Full+Lite
Gets the component open_onclick property.
Function ng.Component.get_input_html () vs. 1.1.4 Full+Lite
Get the HTML table code for an input field and button holder. The code will not contain the input or the button.

ng.PlugIn (options) Custom Events

In the events' functions, the this will refer to the class object.
Event onBeforeRemove vs. 1.2.2 Full+Lite
This event will fire right before the plugin (or any object that inherit it, e.g. components) is removed.

ng.Component (options) Custom Events

In the events' functions, the this will refer to the class object.
Event onOpen vs. 1.1.0 Full+Lite
Fires when the component is opened.
Event onClose vs. 1.1.0 Full+Lite
Fires when the component is closed.
Event onEnable vs. 1.1.0 Full+Lite
Fires when the component is enabled.
Event onDisable vs. 1.1.0 Full+Lite
Fires when the component is disabled.