Shadows
Problem: editing shadows is a drag, especially if the shadow style contains multiple shadows
// Set shadow colors
let node = figma.currentPage.selection[0]
let nodes = figma.currentPage.selection
function clone(val) {
return JSON.parse(JSON.stringify(val))
}
const baseColor = findOne (swatch =>
swatch.name === "shadowColor"
)
nodes.forEach (node => {
let newEffects = clone(node.effects)
newEffects.forEach (effect => {
effect.color.r = baseColor.fills[0].color.r
effect.color.g = baseColor.fills[0].color.g
effect.color.b = baseColor.fills[0].color.b
})
node.effects = newEffects
})