I'm new here so please forgive me if I have missed something obvious!
I am trying to write a script that finds all Color Variables linked to my Text Styles and Layer Styles, and swaps them to link to a new Color Variable with an analogous name. For example, if I find a Layer Style with a fill that links to the Color Variable named 'LightTheme/Text/Body' it swaps it to 'DarkTheme/Text/Body'.
I am sure that I cannot do this part using the JS API.
I can see from this post that I can use swatch.referencingColor to set a color and maintain a Color Variable link.
This post shows me that I can find existing swatch IDs on a text style. I know I can get a swatch from an ID using
It is not clear where I can actually set a swatch to a color property on a text or layer style though. Can anyone tell me if this is doable, and if so, where can I find the setable properties.