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
void
able
(
)
show color picker, able text input
- Returns:
void
Chainable: This method is chainable.
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
void
disable
(
)
hide color picker, disable text input
- Returns:
void
Chainable: This method is chainable.
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
String
getColorType
(
)
get the color's type, rgb is return rgba too
- Returns:
String
- hsba|hex|rgba, or return 'error'
String
hexToComplate
(
)
transform hex color #fff
to #ffffff
Object
hexToRgba
(
)
transform hex to rgba
Object
hsbToRgba
(
support
)
transform hsb or hsba to rgba
- Parameters:
-
support
<String|Object>
hsb and hsba color
- Returns:
Object
Boolean
isHEX
(
)
if the color is hex
Boolean
isHSB
(
)
if the color is hsb
Boolean
isHSBA
(
)
if the color is hsba
Boolean
isRGB
(
)
if the color is hsb
Boolean
isRGBA
(
)
if the color is rgba
void
reset
(
)
reset all, color is 'transparent', will not run onChange
- Returns:
void
Chainable: This method is chainable.
String
rgbToHex
(
support
)
transform rgb or rgba to hex
- Parameters:
-
support
<Object>
rgb or rgba
- Returns:
String
Object
rgbToHsba
(
support
)
transform rgb or rgba to hsba
- Parameters:
-
support
<String|Object>
rgb or rgba
- Returns:
Object
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
(
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
(
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
(
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
(
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
(
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
(
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
(
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 for init, support rgba|rgb|hsb|hsba|hex|
keywords|"transparent"
Default Value: 'transparent'
if the param include rgba and rgb when run the callback function({rgba:xxx,rgb:xxx}){}
or function(rgba|rgb){}
Default Value: false
if the current broswer is support rgba
callback when color change
Default Value: 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'