• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Color filling in dropdown items

Community Beginner ,
Nov 24, 2022 Nov 24, 2022

Copy link to clipboard

Copied

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.

 

Screenshot 2022-11-23 181041.png

 

Please I have need your help

TOPICS
Acrobat SDK and JavaScript

Views

106

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Nov 24, 2022 Nov 24, 2022

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

Likes

Translate

Translate
Community Expert , Nov 24, 2022 Nov 24, 2022

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

 

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

Likes

Translate

Translate
Community Expert ,
Nov 24, 2022 Nov 24, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 24, 2022 Nov 24, 2022

Copy link to clipboard

Copied

Thank You So much

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 24, 2022 Nov 24, 2022

Copy link to clipboard

Copied

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

 

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 26, 2022 Nov 26, 2022

Copy link to clipboard

Copied

LATEST

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines