Skip navigation
Currently Being Moderated

Apply Random Color to Group of Objects

Jun 18, 2009 9:31 AM

Hello all, thanks for taking the time to help.

 

Here's my issue... lets say I have 600 different objects in illustrator (just little circles with a fill color, no stroke) and 6 different colors that these circles should be. That means, I'd like about a 100 to be one color, 100 another color, etc... Is there anyway to select all 600 and just tell Illustrator that I have these 6 colors and I want to apply them to the selected objects randomly?

 

Let me know if this is confusing... hopefully there is some option to do this. I don't want to apply them manually...

 

Thanks!

 
Replies
  • Currently Being Moderated
    Jun 18, 2009 9:38 AM   in reply to stairatthesun

    You might check out the JET_RandomFillSwatches script in this collection by James Talmage.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 18, 2009 10:59 AM   in reply to stairatthesun
    I was wondering if you knew why it included black and transparent as colors in the random swatch group?

     

    You can't delete the no-fill and registration swatches from the palette, so I guess they're always included in the group.

     

    I hope James will be along with a solution to this. I'll ponder the script in the meantime.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 18, 2009 11:50 AM   in reply to Harron K. Appleman

    Rats. The [none] (no-color) swatch is stubborn.

     

    I was able to remove the [registration] swatch from the mix by making sure it's at the head of the palette and adding a (If swatchIndex>1) test to the script. But I can't get rid of the [none] swatch no matter what I do. Illustrator must treat it as a special case so that it cannot be referred to by index number.

     

    Help, James!

     

    One other thing: Not for nothing, but...

    lets say I have 600 different objects in illustrator (just little circles with a fill color, no stroke) and 6 different colors that these circles should be. That means, I'd like about a 100 to be one color, 100 another color, etc.

    ...is not exactly the same thing as...

    select all 600 and just tell Illustrator that I have these 6 colors and I want to apply them to the selected objects randomly

     

    What you want is a uniform distribution of those six colors but in no discernible pattern. That's not true random assignment, and this script won't get you there even if got the unwanted swatches out of the mix.

     

    No obvious solution here.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 18, 2009 12:10 PM   in reply to Harron K. Appleman

    OK. Got it. Had to modify the script a bit more.

     

    RandomSwatchFill.gif

     

    As I wrote in the previous post, this is done with a random number generator, and that's not exactly what you want. But if you want to play with the script, here is the modified version:

     

    http://harron.home.acedsl.com/Misc/HKA_RandomSwatchFIll.zip

     

    Make sure you make the undeletable swatches -- [none] and [registration] -- the first two in the palette/panel.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 9, 2010 5:55 PM   in reply to Harron K. Appleman

    This link no longer works. Would you happen to have a working link for this script?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2010 6:37 AM   in reply to Seb29

    Please try the link again. I've put the file back up on the server.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2010 6:59 AM   in reply to Harron K. Appleman

    Thanks so much!

     

    Cheers,

    Seb

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 7, 2011 12:50 PM   in reply to Seb29

    And the link is dead again. Mind putting it back up?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 24, 2011 6:19 AM   in reply to stairatthesun

    Can you please put the script back on the link?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2011 1:06 PM   in reply to itchysan

    OK. It's back. URL remains the same.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2011 2:49 PM   in reply to Harron K. Appleman

    Harron.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 25, 2011 3:01 PM   in reply to Jacob Bugge

    Jacob.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 26, 2011 2:33 AM   in reply to Harron K. Appleman

    You were missed over here the other day, Harron.

     

    http://forums.adobe.com/message/4034311#4034311

     

    And the other days.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 29, 2011 11:44 AM   in reply to Harron K. Appleman

    Thanks, Harron!!

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2012 9:29 PM   in reply to Harron K. Appleman

    Harron, you are the MAN! :-D

     

    I wanted to point out that this does not work with compound shapes.  Is there a work around, or am I doing something wrong?

     

    Also, do you have a paypal I can donate to?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 7, 2012 5:59 AM   in reply to Divine bliss

    Glad this is useful, Div.

     

    Unfortunately, compound path items are handled separately in scripting. There is no simple fill command, so subpaths would have to be individually addressed. Then, you'd have to decide how the individual path items within a compound shape (including knockouts) would be handled.

     

    Not saying it can't be done... just that now we're going considerably beyond the original intent of this simple script. And I'm not sufficiently facile with scripting to whip off a solution. I can't think of anything other than the tedious process of busting up compound paths (e.g. with the pathfinder) to get around this limitation.

     

    I appreciate the offer to donate, but that's unnecessary.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points