Copy link to clipboard
Copied
I am trying to create a javascript to change the color to a custom color based on value input.
The only color that seems to work is the value 4 which turns it yellow. The other values are not working. Any suggestions:
This is what I have:
if (event.value=="1") event.target.fillColor = ["RGB", 253, 215, 240];
else if (event.value=="2") event.target.fillColor = ["RGB", 198, 224, 180];
else if (event.value=="3") event.target.fillColor = ["RGB", 204, 236, 255];
else if (event.value=="4") event.target.fillColor = ["RGB", 255, 255, 0];
else event.target.fillColor = color.white;
TIA
As explained in the Acrobat JS Reference, the color values in a color array range from 0 to 1 inclusively. So you need to map the values from 0 to 255 to the range 0 to 1.
Copy link to clipboard
Copied
As explained in the Acrobat JS Reference, the color values in a color array range from 0 to 1 inclusively. So you need to map the values from 0 to 255 to the range 0 to 1.