Skip to main content
Inspiring
Nov 24, 2022 10:46 AM UTC
Answered

Color filling in dropdown items

Hi all respectable members, I want to add RGB Colors in Dropdown items, I am using code in custom calculation, here is my code:

event.value=this.getField("Dp3").value;

if (event.value=="Day (08:00-20:00)")

event.target.fillColor = ["RGB",234,241,221];

else if (event.value=="WN (20:00-08:00)")

event.target.fillColor = ["RGB",217,149,148];

else if (event.value=="Sleeping O/N standby (20:00-08:00)")

event.target.fillColor = ["RGB",184,204,228];

else

event.target.fillColor = color.transparent;

 

but failed is there any way to change colors.

 

 

Please I have need your help

This topic is closed to new replies. Start a new post to keep the conversation going.
JR Boulay
JR BoulayCorrect answer
Community Expert
Nov 24, 2022 4:55 PM UTC

You don't need to divide color values, JavaScript can do it for you:

 

event.target.fillColor = ["RGB", 184/255, 204/255, 228/255];

Acrobate du PDF, InDesigner et Photoshopographe

4 replies

JR Boulay
Community Expert
JR BoulayCommunity ExpertCorrect answer
Community Expert
Nov 24, 2022 4:55 PM UTC

You don't need to divide color values, JavaScript can do it for you:

 

event.target.fillColor = ["RGB", 184/255, 204/255, 228/255];

Translate
Acrobate du PDF, InDesigner et Photoshopographe
Inspiring
Nov 26, 2022 8:26 AM UTC

Yes I did same. Thank You so much Try67 and JR Boulay

Translate
try67
Community Expert
Community Expert
Nov 24, 2022 11:16 AM UTC

RGB values in Acrobat JS should be between 0 and 1, so divide your values by 255 to get the correct result.

Translate
Inspiring
Nov 24, 2022 12:48 PM UTC

Thank You So much

Translate