Skip to main content
Participating Frequently
February 22, 2014
Answered

Show color picker dialog JSX / CSAW

  • February 22, 2014
  • 3 replies
  • 11153 views

Can someone guide me on how to show the color picker dialog in Illustrator programmatically?

In photoshop that's really easy, just:

     app.showColorPicker(true);

In Illustrator I couldn't find any reference to such a method or other possibility to show the dialog programmatically, that you would normally get when double clicking on the fill color square within Illustrator.

Is that possible by using app.executeMenuCommand or some other method?

I am writing a script that opens the color picker dialog in reaction to a click on a button. I want to be able to get the chosen color and use it within the script.

thanks for the help!

Dominik

This topic has been closed for replies.
Correct answer CarlosCanto

I'm not sure if you can bring up Illustrator's color picker, in the mean time you can play with JS color picker

alert($.colorPicker ());

3 replies

Inventsable
Legend
June 15, 2020

In case any one is reading this in the future like I was earlier today, you can indeed use the native color picker:

var startColor = new CMYKColor();
var result = app.showColorPicker(startColor);

alert(result)
schroef
Inspiring
May 11, 2020

It does show the picker, issue is. When I link this to a button for say a dialog window. Closing the colorpicker also closes the dialog window. I wanted to use this method to let user refine a color. 


CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
February 22, 2014

I'm not sure if you can bring up Illustrator's color picker, in the mean time you can play with JS color picker

alert($.colorPicker ());

Participating Frequently
February 22, 2014

Hey Carlos, thanks for the fast answer!

Yeah I already saw that it's possible to bring up the native color picker via JSX, is there an easy way to execute the same from an ActionScript environment / or can I execute a jsx script function and get the result from AS?

Participating Frequently
February 24, 2014

Dominik,

Nice job (whoa, cool to see strong typing again). Are you using Scripting Listener plugin with Illustrator? Does the PS one work with Illustrator? I am asking as I saw you posted at the link below and it mentions Illustrator however the link for the install is for Photoshop, so I was curious about the workflow/process for Illustrator?

http://thirdroute.com/blog/2013/7/6/jsx-scripting-with-creative-suite-extensions-in-practice

The Workflow

First, install the Scripting Listener plugin. With it installed, whenever you do something in Photoshop/Illustrator/etc, it will write the code needed to perform those steps to ScriptingListenerJS.log on your desktop.


Actually I just followed the guidance of Brian Reavis blog article (the one you mentioned) in combination with the Adobe reference of the CSXS api for actionscript (shipped with the extension builder 2.1).

I used the scriptlistener plugin a lot for Photoshop and it really helps for the cryptic action manager magic that's happening there. I don't know if there is something similar within illustrator since I just started developing for it yesterday. That's also the reason for my question here, I couldn't believe that something that's unbelievably easy in photoshop could be so hard (or not even possible) with the illustrator api.

If you are interested, you can follow my work at Code Adventure where I am working on Adobe creative suite extension to simplify basic workflows for designers. My goal is also to release a lot of the stuff I coded in hours of trial and error as open source on github

A real eye opener to extension development was the great blog post by Creative Market on how they built their extension with a mixture of Html, Javascript, css embedded within a custom Flex HTML component.

I also forked their amazing CSXS build tool they built to generate the extension packages. With this you can actually circumvent the commercial extension builder and come really close to a great development environment ;-)

A possible future might be a online service where you can configure your basic extension information like the name, icons etc. and download a complete build, based on the opinionated infrastructure mentioned above!