//Changes the color for all Live Effects on selected objects //Aaron Beall - http://abeall.com var sel = new Array().concat(fw.selection); if(sel.length <= 0){ alert('This command requires an active selection!'); }else{ var error = ""; do{ var amount = prompt(error+'Enter a valid HEX color(ex. #ffaabb) to set all Live Filters Color.\n\nRecognized Filters include: Color Fill, Glows, Shadows and Outer Bevel. (TIP: Solid Shadow is only affected if Solid Color is set to true.)'); error = "You need to enter a full RGB HEX color value. The hash(#) is optional.\n\n"; } while(!isColor(amount) && amount!=null); makeColor(amount); if(amount!=null){ for(var i in sel){ if(!sel[i].effectList)continue; var effs = sel[i].effectList.effects; for(f in effs){ if(effs[f].EffectIsVisible){ var eff = {}; for(var p in effs[f]){ if(p!='javascriptString')eff[p] = effs[f][p]; } if(eff.Color!=undefined)eff.Color = amount; if(eff.OuterBevelColor!=undefined)eff.OuterBevelColor = amount; if(eff.ShadowColor!=undefined)eff.ShadowColor = amount+eff.ShadowColor.substr(7); if(eff.color!=undefined && eff.color.substr(7)!='00')eff.color = amount; effs[f] = eff; } } } } } function isColor(val){ if(val==null)return false; val = val.split('#').join('').split(' ').join(''); if(val.length!=6)return false; //todo: validate HEX value return true; } function makeColor(val){ if(val==null)return false; if(val.substr(0,1)!='#')val = '#'+val; val = val.substr(0,7); }