jQuery UI theme for canvas -


i'm using canvas in web app built jquery ui. added theme-roller widget , want canvas elements themeable. problem i'm facing is, how programatically access css class properties use while drawing canvas objects?

this tried:

var color = $("<div></div>").addclass("ui-state-default").css("background-color");   

got it. element needed added dom.

function getclassproperty(clazz,prop,type){     type = (type || false) ? type : "div";     var dummy = $("<"+type+" style='display=none;'></"+type+">").addclass(clazz).appendto("body");     var value = dummy.css(prop);     dummy.remove();     if(value.indexof("rgb") != -1){         var digits = /(.*?)rgba?\((\d+),\s?(\d+),\s?(\d+)[\),]/.exec(value);         return "#" + (parseint(digits[4])|(parseint(digits[3])<<8)|(parseint(digits[2])<<16)).tostring(16);     }else{         return value;     } } console.log(getclassproperty("ui-state-default","background-color")); 

rgb2hex code taken from: http://haacked.com/archive/2009/12/29/convert-rgb-to-hex.aspx


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -