Copy link to clipboard
Copied
Hi,
In a PDF document, I want to change the colour of a button by using this code:
event.target.fillColor = color.black;
How can I personalize the colour? The RGB colour is 190, 21, 34.
Thanks,
Copy link to clipboard
Copied
The color object in Acrobat JS is an array with a color-space name and the values between 0 and 1.
So your example would be:
event.target.fillColor = ["RGB", 190/255, 21/255, 34/255];
By the way, in the future please post follow-up questions under the original thread.
Copy link to clipboard
Copied
The color object in Acrobat JS is an array with a color-space name and the values between 0 and 1.
So your example would be:
event.target.fillColor = ["RGB", 190/255, 21/255, 34/255];
By the way, in the future please post follow-up questions under the original thread.
Copy link to clipboard
Copied
This is fabulous, thanks so much!
Copy link to clipboard
Copied
Do you think it's possible to make it change to white when I click again on the button?
What I mean is that I click once, it turns red, if I click again it turns to white and vice-versa.
Copy link to clipboard
Copied
Sure, that's possible. You can use this code to it:
if (color.equal(event.target.fillColor, color.white)) event.target.fillColor = ["RGB", 190/255, 21/255, 34/255];
else event.target.fillColor = color.white;
Copy link to clipboard
Copied
It works perfectly ! I really appreciate your help, thank you !

