Skip to main content
Question

Populating setValueForMode with dynamic values

  • September 22, 2023
  • 2 replies
  • 397 views

brian.theuma

I’m experimenting with a plugin that creates color shades variable sets. I’m stuck on dynamically creating the shades.

let’s say I have this:

const baseColor = { r: 77, g: 77, b: 77 };
colorVariableDefault.setValueForMode(valuesColId, baseColor);
colorVariableDark25.setValueForMode(valuesColId, darkenColor(baseColor, 25));

setValueForMode is not allowing me to use the baseColor variable value, instead it ONLY accepts { r: 0, g: 0, b: 0 } to be written inside it.

any help would be appreciated.

This topic has been closed for replies.

2 replies

brian.theuma
  • Author
  • September 22, 2023

Actually my bad, solved … the RGB values to be used are 0 to 1 and not 0 to 255.


tank666
  • September 22, 2023

You can also use the utilities:

figma.com