I am working on a project where i need to draw several trees and plethora of leaves of multiple colors.

As it is a time consuming approach so i set an action where the action is set to change stroke into fill. Workflow was fine as long as stroke color were same.

But as am mixing several color leaf this action is not working anymore. Manually i have to change each stroke into fill.

And if i apply magic wand some other portion of trees get selected.

Why the action is not working for multiple color strokes?? enter image description here


4 Answers 4


Perhaps try a different approach. You could create multiple coloured leaves using a script to randomly fill with some chosen colour swatches.

There's a free Random Swatches Fill script here. I have no connection with the website or the script developer.

I tested the script in CC 2018 and it still works. However to use it in CC versions you will need to change the file extension from .js to .jsx, and put it in your Illustrator Scripts folder.

  1. Draw a bunch of leaves. If you drew them with a brush like I did, select them all and click Object > Expand Appearance, so that they are just filled shapes. Make sure they are all ungrouped

  2. Select all

  3. In the Swatches panel, make sure to activate the Fill option, then hold down Ctrl/Command and make a multiple selection of all the swatches you want to use.

  4. click File > Scripts > RandomSwatchesFill

enter image description here

In case the link above ever rots, here's an additional link to what appears to be the origin of the script. https://github.com/robotwood/Random-Swatch-Fill

  • wow.... its so cool... didnt know... Thank you. Feb 28, 2020 at 7:06
  • It's unclear to me the license that the code was intended on being released under - my gut says it's not CC-BY-SA 4.0, and so (IMO) would not suitable for inclusion on the site.
    – Tyzoid
    Feb 28, 2020 at 18:51
  • @Tyzoid According to google, the first appearance of the file on the web seems to be here github.com/robotwood/Random-Swatch-Fill - the readme makes no mention of a licence.
    – Billy Kerr
    Feb 28, 2020 at 19:11
  • 1
    @Tyzoid I only included the script because of link rot but since you've objected I'm removing it, and instead I'm posting a link to what appears to be the original file on github.
    – Billy Kerr
    Feb 28, 2020 at 19:21
  • @BillyKerr Generally, what I do in the case I'm worries about link rot, is to throw the content in through the WayBack machine and to trigger a manual archive.
    – Tyzoid
    Feb 28, 2020 at 23:05

I don't have a direct answer to your question, but I have an idea for an action that will save some time.

The following may work...

  1. Organize your leaves into a single layer.
  2. Select the TOP object.
  3. Create a new action with two steps.
    • Swap fill-stroke ( Shift+X )
    • Select the object below ( Ctrl+Alt+[ )
  4. Play the action until you've swapped the fill and stroke for every leaf.

enter image description here (in the video, the mouse is hovering over the stop button, but I'm using F3 to play the action)

  • wow.... top object matters here. remembering that in my case is difficult. but i love this approach. Feb 28, 2020 at 7:09
  • This is a brilliant workaround! I thought for some time on this, but this is pretty neat.
    – Welz
    Feb 28, 2020 at 13:26
  • @WELZ, thx for the kind words and adding those cool stylized key icons. SuraiyaAbedin, glad this is an approach you love.
    – LWSChad
    Feb 28, 2020 at 21:16

In order for the Shift-X shortcut to work in inverting fills/strokes the fill and stroke color has to be the same for everything selected. It simply doesn't work with selections of multiple, different colored, objects.

And there is no universal "toggle fill and stroke colors" option which I am aware of, especially if the colors continually vary.

It may be easier to perhaps to set all the strokes the same color, then use Live Paint to add fills easily, while changing colors as desired. Then, simply remove all the strokes.

  • am not familiar with live paint... nvr used.. but now i see i have to get acquainted with it. Thank you for teaching me this. Feb 28, 2020 at 7:13

You can speed this up if you have some objects in the same fill/stroke combo:

  • Select one of these objects
  • Go to Select → Same → Fill & Stroke
  • Hit Shift+X
  • Thank you ,i didn't know about this feature. Feb 28, 2020 at 7:04

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.