My favorites | Sign in
Project Logo
                
Search
for
Updated May 15, 2008 by chris4403
Document  

Functions

$.isHexadecimalColor(color)

check the input string is Hexadecimal form (#nnn or #nnnnnn).

$.isHexadecimalColor('#555');//true
$.isHexadecimalColor('#000000');//true
$.isHexadecimalColor('#ggg');//false
$.isHexadecimalColor('#0000');//false

$.isRGBColor(color)

check the input string is RGB form (rgb(nnn,nnn,nnn)).

$.isRGBColor('rgb(0,0,0)');//true
$.isRGBColor('rgb(255,255,255)');//true
$.isRGBColor('rgb(256,255,255)');//false
$.isRGBColor('#000000');//false

$.isColor(color)

check the input string is Hexadecimal form or RGB form

$.isColor('#555');//true
$.isColor('#000000');//true
$.isColor('rgb(0,0,0)');//true
$.isColor('rgb(255,255,255)');//true
$.isColor('rgb(256,255,255)');//false

$.RGB(color)

Input color form string , return numeric array ,length is three and mean rgb color value. Input numeric array which length is three, return rgb form string.

$.RGB('rgb(0,0,0)');//[0,0,0]
$.RGB('#ffffff');//[255,255,255]
$.RGB([2,3,4]);//rgb(2, 3, 4)

$.colorVectorValue(color)

$.colorVectorValue('#000000');//0
$.colorVectorValue('#010101');//1.73
$.colorVectorValue('#ffffff');//441.67

$.colorDecimalValue(color)

$.colorDecimalValue('#000000');//0
$.colorDecimalValue('#000001');//1
$.colorDecimalValue('#f00000');//15728640
$.colorDecimalValue('#ffffff');//16777215

$.fmtColor(color,fmt)

$.fmtColor('#000');//rgb(0, 0, 0)
$.fmtColor('#ffffff');//rgb(255, 255, 255)
$.fmtColor('rgb(0, 0, 0)');//#000000
$.fmtColor('rgb(0, 0, 0)','rgb');//rgb(0, 0, 0)
$.fmtColor('rgb(0, 0, 0)','hexadecimal');//#000000
$.fmtColor('#000000','rgb');//rgb(0, 0, 0)
$.fmtColor('#000000','hexadecimal');//#000000

$.modColor(color,color_code,value) / $.modColor(color,paramObj)

$.modColor('#000000','r',5);//rgb(5, 0, 0)
$.modColor('#000000',{'r': 5,'g': 10,'b': 15});//rgb(5, 10, 15)
$.modColor('rgb(0, 0, 0)','g',255);//rgb(0, 255, 0)
$.modColor('rgb(0, 0, 0)',{'r': 5,'g': 10,'b': 15});//rgb(5, 10, 15)

$.averageColor(colors)

$.averageColor(['#000000']);//rgb(0, 0, 0)
$.averageColor(['#ff0000','#0000ff']);//rgb(128, 0, 128)

$.colorize(text) / $.colorize(paramObj)

$.colorize('coffie');//#c0ff1e
$.colorize('loaded');//#10aded
$.colorize('kids');//#000000
$.colorize({max:100,min:0,value:50});//#0ccbd0

$.fn.averageColor()

$(_selector_).averageColor();//rgb(136, 136, 136)

$.fn.sortByColor()

$(_selector_).sortByColor();

Sign in to add a comment
Hosted by Google Code