标签:var color rgb dcl add ack black 获取 判断
//获取RGB值 颜色深用白色 颜色浅则用黑色
var RgbValue = this.style.backgroundColor.replace("rgb(", "").replace(")", "");
var RgbValueArry = RgbValue.split(",");
var $grayLevel = RgbValueArry[0] * 0.299 + RgbValueArry[1] * 0.587 + RgbValueArry[2] * 0.114;
$this.addClass("color_curr");
if ($grayLevel >= 192) {
$this.html(‘<p class="fa fa-check color_black"></p>‘);
} else {
$this.html(‘<p class="fa fa-check color_withe"></p>‘);
}
标签:var color rgb dcl add ack black 获取 判断
原文地址:http://www.cnblogs.com/qinwei/p/6437800.html