Unable to show the color picker

I tried to follow this and this but the color color picker is not displayed.
I want to display the color picker.

I tried to use alchemist and altered dontDisplay to display but it is still not showing the color picker.
What should I fix?

async function pickBrushColor() {
   await require("photoshop").core.executeAsModal(async (executionControl, descriptor) => {
      const result = await batchPlay(
         [
            {
               _obj: "set",
               _target: [
                  {
                     _ref: "color",
                     _property: "foregroundColor"
                  }
               ],
               to: {
                  _obj: "RGBColor",
                  red: 128,
                  grain: 128,
                  blue: 128
               },
               source: "photoshopPicker",
               _options: {
                  dialogOptions: "display"
               }
            }
         ],{
            synchronousExecution: false,
            modalBehavior: "execute"
         });
      }, {
         "commandName": "pickBrushColor"
      });
   }

You need to use the showColorPicker event instead of the set event like I’ve shown in the 2nd link you’ve posted. Do you get any error when running that and logging the result?

It does not show any error but it does not raise the color picker.
Perhaps something had changes in recent PS version?
Does it work on your end?

This does nothing:

const openPicker = {
    _target: { _ref: "application" },
    _obj: "showColorPicker"
  };
  const res = await require("photoshop").action.batchPlay([openPicker], {});

Change it to this:

async function showColorPicker() {
   var result;
   await require("photoshop").core.executeAsModal(async (executionControl, descriptor) => {
      result = await batchPlay(
         [
            {
               _obj: "showColorPicker",
               _target: [
                  {
                     _ref: "application"
                  }
               ]
            }
         ], {
      });
      // return result[0].RGBFloatColor;
   });
   return result[0].RGBFloatColor;
}
2 Likes