I've finaly found a solution to request a color to the user by using the after effect color window with the 'pipette' (color picker),
I post this script here if someone else look for something similar, or if you have some notes/comments to make this function better.
Code: Select all
var solidColorPickerName="zzz_solidColorPicker_zzz"; // name use for the temporary solid
var solidColorPickerName_DefaultColor=[0.5,0.5,0.5]; // default color for the temporary solid ( use to check user modification or cancel button)
var needsMsg="To use this function, you need to be in a comp\n(Composition panel)";
function userColorPicker(){
var result=false;
var curComp=app.project.activeItem;
if (curComp==null ){alert(needsMsg);}else{
if(curComp.typeName!="Composition"){alert(needsMsg); }else{
var userColor;
var solidSize=50;
//creation of a temporary solid
mySolid=curComp.layers.addSolid(solidColorPickerName_DefaultColor, solidColorPickerName, solidSize, solidSize, 1, 1);
mySolid.moveToEnd(); // i prefer, because some random value use layer index and like that there is no change
mySolid.transform.position.setValue([-solidSize/2,-solidSize/2]); // solid not visible in comp => user can pick what he want
mySolid.selected=true; // => to activate timeline ang ive acces to the solid setting menu
app.executeCommand(app.findMenuCommandId("Solid Settings..."));
//--> waitting while solid setting windows is open
var userTmpColor=mySolid.source.mainSource.color; //checking the new color of he solid (define by user)
// test if color is different from default (detecting the cancel action on solid setting) anf if it's case memorisation of new color
if(userTmpColor.toString()!=solidColorPickerName_DefaultColor.toString()){result=userTmpColor;}
//remove of the temporary solid
mySolid.source.remove();
}
}
return result;
}
userColor=userColorPicker();
if(userColor){alert(userColor);}

Tks for your comment.
Mr