Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the layer visible label color(设置图层可见标签颜色) #1

Open
tomieric opened this issue Aug 23, 2019 · 0 comments
Open
Labels
layer 图层

Comments

@tomieric
Copy link
Member

tomieric commented Aug 23, 2019

function setLayerIconColor(color) {
    var cTID = function(s) { return app.charIDToTypeID(s); };
    var sTID = function(s) { return app.stringIDToTypeID(s); };
    var colors = {
        red: 'Rd  ',
        orange: 'Orng',
        yellow: 'Ylw ',
        green: 'Grn ',
        blue: 'Bl  ',
        violet: 'Vlt ',
        purple: 'Vlt ',
        gray: 'Gry ',
        grey: 'Gry '
    };

    var desc1 = new ActionDescriptor(); 
    var ref1 = new ActionReference();
    ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
    desc1.putReference(cTID('null'), ref1); 
    var desc2 = new ActionDescriptor();
    desc2.putEnumerated(cTID('Clr '), cTID('Clr '), cTID(colors[color] || 'None'));
    desc1.putObject(cTID('T   '), cTID('Lyr '), desc2); 
    executeAction(cTID('setd'), desc1, DialogModes.NO);
  };
 
// 设置为红色
setLayerIconColor('red');

Reference

@tomieric tomieric added the layer 图层 label Aug 23, 2019
@tomieric tomieric reopened this Aug 23, 2019
@tomieric tomieric changed the title 设置图层可见标签颜色 Set the layer visible label color(设置图层可见标签颜色) Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
layer 图层
Projects
None yet
Development

No branches or pull requests

1 participant