How to access the Blendmodes in Photoshop Constants

Hello everyone!
I am now able to run the plugin for the simple tasks like opening and closing files, now I wanted to be able to apply Layer BlendModes to a layer and read the documentation about how to get them, but apparently I do not understand the API correctly.
Even though I did import the constants obj. I do not know how to extract the BlendModes out of the object.
I hoped it would be stored in an array, or that if I would use an array with the exact names, it would work, but sadly it did not so far.
[https://developer.adobe.com/photoshop/uxp/2022/ps_reference/modules/constants/#blendmode]

Maybe one of you can support me with this!
Cheers,
Oliver

At the top of your linked page it shows how to use

const {constants} = require("photoshop")
console.log(constants.BlendMode.COLOR)
2 Likes

Dissolve example…

const { app, core, constants } = require("photoshop");

async function dissolveSelectedLayer() {
    const doc = app.activeDocument;
    const layer = doc.activeLayers[0];
    await core.executeAsModal(async () => {
        layer.blendMode = constants.BlendMode.DISSOLVE;
    });
}
1 Like

Hey guys @Karmalakas and @jduncan ,
thank you!

I did not see it, like looking but not seeing.
I will implement it like Josh showed.

Already imported the object before, but got stuck as I did not access the stored constants correctly.

Thank you again and have a brilliant day!
Cheers,
Oliver

1 Like