Copy link to clipboard
Copied
Another dumb question...I'm using the following scripting to produce the colored values in the image below:
if (event.value>Number(this.getField("AverageCovg").value))
event.target.fillColor = color.green;
else event.target.fillColor = color.red;
It works like a charm, BUT ... how do you modify the colors so it's a different shade (darker)? I'm looking to have it produce a darker green and red, instead of the bright green and red that seem to be standard.
Appreciate any help!
Copy link to clipboard
Copied
If you want to specify a custom color you need to know its RGB values, and then convert them to the format that Acrobat JS uses, which is a number between 0 and 1, instead of the normal 0-255.
So let's take "Forest Green", which is defined as "34-139-34". To use it in our script we need to convert the values, by dividing them by 255 and then put them in a special array, like so:
var myForestGreen = ["RGB", 34/255, 139/255, 34/255];
Then we can use it in the code like this:
event.target.fillColor = myForestGreen;
The same can be done using CMYK values, by the way, or gray-scale.
Copy link to clipboard
Copied
If you want to specify a custom color you need to know its RGB values, and then convert them to the format that Acrobat JS uses, which is a number between 0 and 1, instead of the normal 0-255.
So let's take "Forest Green", which is defined as "34-139-34". To use it in our script we need to convert the values, by dividing them by 255 and then put them in a special array, like so:
var myForestGreen = ["RGB", 34/255, 139/255, 34/255];
Then we can use it in the code like this:
event.target.fillColor = myForestGreen;
The same can be done using CMYK values, by the way, or gray-scale.
Copy link to clipboard
Copied
PS. It's not a dumb question at all...
Copy link to clipboard
Copied
Again, thank you!

