[Jquery] RGB表記を16進数表記に変換

add to hatena hatena.comment (0) add to del.icio.us (0) add to livedoor.clip (0) add to Yahoo!Bookmark (0) Total: 0

Jqueryのcss(‘color’)だと返り値がRGB表記なので16進数で取得したい。
という方はGoogle color utils.

$.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

参考サイト

http://code.google.com/p/jquery-color-utils/
http://code.google.com/p/jquery-color-utils/wiki/Document

Leave a Reply

You must be logged in to post a comment.