Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
scope.setColor = function(color){
let tinColor = tinycolor(color);
UtilService.setRefValue(scope.data, scope.definition.ref, tinColor.toRgbString());
$element.find(".colorPalette").css("background-color", tinColor.toRgbString());
$element.find(".colorPaletteIcon").css("color", tinycolor.mostReadable( tinColor , ['#595959', '#fff']).toHexString());
scope.$emit("saveProperties");
};
let colorObj = {};
if(!color){
return;
}
if(!color.tiny){
colorObj.tiny = tinycolor(color);
}else{
colorObj = color;
}
if(colorObj.tiny.getAlpha() < 0.5){
$element.find(".colorPaletteIcon").css("color", '#595959');
}else{
$element.find(".colorPaletteIcon").css("color", tinycolor.mostReadable( colorObj.tiny , ['#595959', '#fff']).toHexString());
}
}