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

Javascript to change the background color a custom color to based on user input.

New Here ,
Nov 02, 2018 Nov 02, 2018

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

TOPICS
Acrobat SDK and JavaScript , Windows
548
Translate
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 1 Correct answer

LEGEND , Nov 02, 2018 Nov 02, 2018

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.

Translate
LEGEND ,
Nov 02, 2018 Nov 02, 2018
LATEST

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.

Translate
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