Change layer color in layer palette
I want to be able to change the layer color in the layer palette using javascript. Is there a way to do this without using confusing code such as the code here? https://forums.adobe.com/thread/1185681
I want to be able to change the layer color in the layer palette using javascript. Is there a way to do this without using confusing code such as the code here? https://forums.adobe.com/thread/1185681
There's no Domestic Oriented Model method for this, so you are limited to write own Action Manager function that after all would be source for future DOM way to get the same. You can only write it more readable (whatever you consider for that):
function color(color) {
function sTT(v) {return stringIDToTypeID(v)}
(ref1 = new ActionReference()).putEnumerated
(sTT('layer'), sTT('ordinal'), sTT('targetEnum'));
(dsc1 = new ActionDescriptor()).putReference(sTT('null'), ref1);
(dsc2 = new ActionDescriptor()).putEnumerated(c = sTT('color'), c, sTT(color))
dsc1.putObject(sTT('to'), sTT('layer'), dsc2), executeAction(sTT('set'), dsc1)
}
color({1:'none', 2:'red', 3:'orange', 4:'yellowColor', 5:'green', 6:'blue', 7:'violet', 8:'gray'}[7])
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.