PDF Automation Station

PDF Automation Station

Setting Color With JavaScript in Acrobat Pro

Working with the color object

David Dagley's avatar
David Dagley
Jul 26, 2025
∙ Paid
Share
rainbow frequency
Photo by Ricardo Gomez Angel on Unsplash

The Color Object

Run the word color in the JavaScript console and it will return [object object]. Since Acrobat has a built-in object called color, you should never use the word color as a variable because that term is already taken and your variable will override the built-in color object, rendering it useless for the remainder of the session.

Run the following script in the console:

for(i in color)
{console.println(i)}

The JavaScript Console

The JavaScript Console

David Dagley
·
February 17, 2024
Read full story

It will return the following list:

  • equal

  • convert

  • transparent

  • black

  • white

  • dkGray

  • gray

  • ltGray

  • red

  • green

  • blue

  • cyan

  • magenta

  • yellow

The first two in the list are functions. The color.equal function compares two color arrays to see if they are equal and returns true or false. Since color arrays can be expressed as RGB, CMYK, G, or T (transparent) the conversion is done if necessary. For example:

color.equal(["RGB",0.5,0.5,0.5],["G",0.5]);//returns true
color.equal(["RGB",0.5,0.5,0.5],["G",0.75])//returns false

Get the course above, and a suite of automation tools for FREE with a Professional subscription.

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 David Dagley
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture