7

I have a couple hundred paths in one image.

Example of many paths

Is there a tool in Illustrator that would allow me to select a few (10) colors, and then using those colors to randomly fill all my paths.

An example would be a military camouflage pattern


There's a tool in Illustrator called Recolor Artwork (However I don't believe that this solves my dilemma)

Recolor Artwork Symbol

Recolor Artwork Panel

I'm not exactly sure how this tool works. I believe that it recolors the artwork, meaning that if all of your paths are already colored in, you can "randomly" change their colors.

I'm looking for a way to do the first step (once I have all my paths filled, I can use the Recolor Artwork in order to change hues etc.)

Edit:

So I've found multiple different scripts that accomplish this (and they do it quite well), but I'm still curious if there's a way to do it within Illustrator, since running the scripts is kind of a hassle - and if I want to reset my colors, I have to do it again. (is there a way I can make it into an action?)

2

2 Answers 2

7

There is a free script from Vector boom which accomplishes this task.

mySelection = app.activeDocument.selection;
myDoc = app.activeDocument;
if (mySelection instanceof Array)
{
    selSwatches = myDoc.swatches.getSelected();
    
    if(selSwatches.length != 0)
        for (i=0; i<mySelection.length; i++)
        {
            if(mySelection[i].typename == "PathItem" || mySelection[i].typename == "CompoundPathItem")
            {
                selItem = mySelection[i];
                selItem.filled = true;

                swatchIndex = Math.round( Math.random() * (selSwatches.length - 1 ));
                
                if(selItem.typename == "PathItem")
                    selItem.fillColor = selSwatches[swatchIndex].color;
                else
                    selItem.pathItems[0].fillColor = selSwatches[swatchIndex].color;
                
            }
        }
}

You can also easily change fillColor to strokeColor (which I did and now have 2 independent scripts, one for each)


Script usage:

  • Select your paths to be filled

enter image description here


  • Ctrl + click and select all your swatches you want to use

enter image description here


  • Run the script

Result:

enter image description here

1

A solution (that I have used personally, a while back) is found in this thread on the official Adobe forums: https://forums.adobe.com/thread/450301

You will have to download and execute a script, found in the first post. In order for the script to work properly, your color swatches need to be ONLY the colors you want applied (and the undeleteable [none] and [registration] swatches) - you will need to delete all other swatches. Then, select the objects you want filled and execute the script.

Hope that works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.