Yahoo! UI Library

codecola-color  1.0.0

Yahoo! UI Library > codecola-color > Y.codecolaColor
Search:
 
Filters

Class Y.codecolaColor - extends Widget

a color control for css3 property

Constructor

Y.codecolaColor ( config )
Parameters:
config <Object> Object literal specifying codecolaColor configuration properties.

Methods

able

void able ( )
show color picker, able text input
Returns: void
Chainable: This method is chainable.

changeColor

String|Object changeColor ( color , nType , oType )
change the color type from nType to oType
Parameters:
color <String|Object>
nType <String> hex|rgb|rgba|hsb|hsba
oType <String> hex|rgb|rgba|hsb|hsba
Returns: String|Object
return Object when rgb|rgba|hsb|hsba, return String when hex

disable

void disable ( )
hide color picker, disable text input
Returns: void
Chainable: This method is chainable.

getColor

String|Object getColor ( )
return the current rgba or rgb color return {String} rgba when the broswer is support rgba, if not return {String} rgb, return {Object} {rgba:xxx, rgb:xxx} when param 'isAll' is ture
Returns: String|Object

getColorType

String getColorType ( )
get the color's type, rgb is return rgba too
Returns: String
hsba|hex|rgba, or return 'error'

hexToComplate

String hexToComplate ( )
transform hex color #fff to #ffffff
Returns: String

hexToRgba

Object hexToRgba ( )
transform hex to rgba
Returns: Object

hsbToRgba

Object hsbToRgba ( support )
transform hsb or hsba to rgba
Parameters:
support <String|Object> hsb and hsba color
Returns: Object

isHEX

Boolean isHEX ( )
if the color is hex
Returns: Boolean

isHSB

Boolean isHSB ( )
if the color is hsb
Returns: Boolean

isHSBA

Boolean isHSBA ( )
if the color is hsba
Returns: Boolean

isRGB

Boolean isRGB ( )
if the color is hsb
Returns: Boolean

isRGBA

Boolean isRGBA ( )
if the color is rgba
Returns: Boolean

reset

void reset ( )
reset all, color is 'transparent', will not run onChange
Returns: void
Chainable: This method is chainable.

rgbToHex

String rgbToHex ( support )
transform rgb or rgba to hex
Parameters:
support <Object> rgb or rgba
Returns: String

rgbToHsba

Object rgbToHsba ( support )
transform rgb or rgba to hsba
Parameters:
support <String|Object> rgb or rgba
Returns: Object

setColor

void setColor ( param.color )
update the attribute 'color', init all the controls, fire the onChange event
Parameters:
param.color <Object> for update the attribute 'color'
Returns: void
Chainable: This method is chainable.

Events

colorChange

colorChange ( event )
Fires when the value for the configuration attribute 'color' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

isAllChange

isAllChange ( event )
Fires when the value for the configuration attribute 'isAll' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

isSupportRGBAChange

isSupportRGBAChange ( event )
Fires when the value for the configuration attribute 'isSupportRGBA' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

keywordsChange

keywordsChange ( event )
Fires when the value for the configuration attribute 'keywords' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

onChangeChange

onChangeChange ( event )
Fires when the value for the configuration attribute 'onChange' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

onInitChange

onInitChange ( event )
Fires when the value for the configuration attribute 'onInit' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

wrapChange

wrapChange ( event )
Fires when the value for the configuration attribute 'wrap' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

Configuration Attributes

color - String

color for init, support rgba|rgb|hsb|hsba|hex|keywords|"transparent"
Default Value: 'transparent'

isAll - Boolean

if the param include rgba and rgb when run the callback function({rgba:xxx,rgb:xxx}){} or function(rgba|rgb){}
Default Value: false

isSupportRGBA - Boolean

if the current broswer is support rgba

onChange - Function

callback when color change
Default Value: function(){}

onInit - Function

callback when widget init
Default Value: function(){}

wrap - String

a css selector for Y.one(),controls will insert into the wrap
Default Value: 'body'


Copyright © 2011 Yahoo! Inc. All rights reserved.