I want to create a modal button that opens the add a layer style settings window

I want to create a modal button that opens the add a layer style settings window provided by photoshop.

Here you go


  const batchPlay = require("photoshop").action.batchPlay;
  const ExecuteAsModal = require("photoshop").core.executeAsModal;

  ExecuteAsModal(async () => {
    return batchPlay(
      [
        // Set Layer Styles of current layer
        {
          descriptor: {
            _obj: "set",
            _target: [
              { _property: "blendOptions", _ref: "property" },
              { _enum: "ordinal", _ref: "layer", _value: "targetEnum" },
            ],
            to: {
              _obj: "blendOptions",
              blendOptions: { _class: "blendOptions" },
            },
          },
          options: { dialogOptions: "display" },
        },
      ],
      {}
    );
  });
1 Like

thank you! Your code works fine!

I have one more question. I wonder if other options such as ‘color overlay’ and ‘outer glow’ windows can be opened using the attached code. Or, could you recommend some literature or resources that I can refer to?

Yes, it is possible, you can open any option inside layer style. Check those resources to learn more.

@Jarda’s plugin Alchemist: https://github.com/jardicc/alchemist

@DavideBarranca YouTube series: https://www.youtube.com/watch?v=zAOUBpDjc1Q&list=PLRR5kmVeh43alNtSKHUlmbBjLqezgwzPJ

Adobe documentation: https://developer.adobe.com/photoshop/uxp/2022/ps_reference/

And finally, you can search for similar topic in this forum.

Cheers.

1 Like

thank you for the great answer Let’s study hard!