Moderator: Paul Tuersley

Topic Author
Posts: 21
Joined: Tue Feb 19, 2013 2:44 pm

Integrate a color picker in UI Panel

Sat Mar 23, 2013 8:40 am


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.

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
                                 //remove of the temporary solid
    return result;


I hope you like, :wink:
Tks for your comment.

Topic Author
Posts: 21
Joined: Tue Feb 19, 2013 2:44 pm

Re: Integrate a color picker in UI Panel

Mon Apr 01, 2013 11:57 pm


No comments ? is it not interresting ? :( or perfect ? :wink:

Posts: 1
Joined: Fri Jul 14, 2017 1:13 pm

Re: Integrate a color picker in UI Panel

Fri Jul 14, 2017 1:19 pm

Hi tapsystem,

your piece of code was very helpful for my soloution to bring up the default color picker of AE.

I use this to add colors to something. Any Idea, how to detect if the user clicks 'cancel'? Because with your solution nothing would happen, if the user would take the default color you picked.

Maybe you get a notification after 4 years. I hope so.


Who is online

Users browsing this forum: No registered users and 1 guest