How can I change the color of a layer?

Hey, guys!
Here I am with another newbie question - I guess haha…

I was playing in order to learn more about UXP Development for Photoshop.
I was trying to change the color of diverse kinds of layers based on input from the user.

I was trying with the following layers: solid color, text, background, and vector.
I couldn’t find a property or method that would help me with any of these layers.
Is there a way to do this? When I needed to write a script a few months ago without uxp I’ve used event listener to achieve similar results.

Can I still use this method? Or is there e better way to achieve it? :slight_smile:
Thank you.

You can use BatchPlay to achieve all that. If you’re already familiar with ActionManager code (the output from Script Listener), that’ll help as BatchPlay is quite the same just with a more modern syntax. You can use Alchemist to inspect stuff and learn how the syntax works.

Regarding the color, I did something similar in one of my plugins a while ago:

  • Solid Color: they have a color property you can set
  • Vector: Vector layers are actually solid color layers (with vector masks)
  • Text: has a color property inside of the TextStyle property
  • Pixel layer: for example set a “Color Overlay” layerstyle
  • Background: Can’t have layerstyles -> a) Select all + fill or b) Edit-> Adjustments -> GradientMap (with one color only)… I’m sure there are more ways to get the result.
1 Like

Thank you so much! :slight_smile: I’ll look for all of these later.