Recolor Artwork: single swatch to multiple swatches
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I have an Illustrator document with a lot of objects. All the objects are black, same swatch.
I have a swatch group with a few dozen coloured swatches. I wish to apply these swatches to all the many black objects. It doesnâÂÂt have to be in any particular order, but each object should be coloured individuallyâÂÂI donâÂÂt just want to change black into some other colour, but to dozens of other colours. What I really want to avoid is having to select each object individually and then applying a different swatch to each.
IâÂÂve never quite managed to get my head properly around the Recolor Artwork feature in Illustrator, and I cannot for the life of me get it to do anything like this. The âÂÂNewâ box in the Recolor Artwork dialogue box appears to accept only one colour.
Is there some way to do this using the Recolor Artwork feature? Or using some other feature that IâÂÂm not aware of? Bonus points if thereâÂÂs a way to control the order in which the colours are applied; e.g., specifying an order and then click on each object in turn to apply each swatch being âÂÂiteratedâ through in that order.
(I would prefer to avoid having to script it, but I will if thereâÂÂs no other way.)
adobe-illustrator
add a comment |Â
up vote
2
down vote
favorite
I have an Illustrator document with a lot of objects. All the objects are black, same swatch.
I have a swatch group with a few dozen coloured swatches. I wish to apply these swatches to all the many black objects. It doesnâÂÂt have to be in any particular order, but each object should be coloured individuallyâÂÂI donâÂÂt just want to change black into some other colour, but to dozens of other colours. What I really want to avoid is having to select each object individually and then applying a different swatch to each.
IâÂÂve never quite managed to get my head properly around the Recolor Artwork feature in Illustrator, and I cannot for the life of me get it to do anything like this. The âÂÂNewâ box in the Recolor Artwork dialogue box appears to accept only one colour.
Is there some way to do this using the Recolor Artwork feature? Or using some other feature that IâÂÂm not aware of? Bonus points if thereâÂÂs a way to control the order in which the colours are applied; e.g., specifying an order and then click on each object in turn to apply each swatch being âÂÂiteratedâ through in that order.
(I would prefer to avoid having to script it, but I will if thereâÂÂs no other way.)
adobe-illustrator
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I have an Illustrator document with a lot of objects. All the objects are black, same swatch.
I have a swatch group with a few dozen coloured swatches. I wish to apply these swatches to all the many black objects. It doesnâÂÂt have to be in any particular order, but each object should be coloured individuallyâÂÂI donâÂÂt just want to change black into some other colour, but to dozens of other colours. What I really want to avoid is having to select each object individually and then applying a different swatch to each.
IâÂÂve never quite managed to get my head properly around the Recolor Artwork feature in Illustrator, and I cannot for the life of me get it to do anything like this. The âÂÂNewâ box in the Recolor Artwork dialogue box appears to accept only one colour.
Is there some way to do this using the Recolor Artwork feature? Or using some other feature that IâÂÂm not aware of? Bonus points if thereâÂÂs a way to control the order in which the colours are applied; e.g., specifying an order and then click on each object in turn to apply each swatch being âÂÂiteratedâ through in that order.
(I would prefer to avoid having to script it, but I will if thereâÂÂs no other way.)
adobe-illustrator
I have an Illustrator document with a lot of objects. All the objects are black, same swatch.
I have a swatch group with a few dozen coloured swatches. I wish to apply these swatches to all the many black objects. It doesnâÂÂt have to be in any particular order, but each object should be coloured individuallyâÂÂI donâÂÂt just want to change black into some other colour, but to dozens of other colours. What I really want to avoid is having to select each object individually and then applying a different swatch to each.
IâÂÂve never quite managed to get my head properly around the Recolor Artwork feature in Illustrator, and I cannot for the life of me get it to do anything like this. The âÂÂNewâ box in the Recolor Artwork dialogue box appears to accept only one colour.
Is there some way to do this using the Recolor Artwork feature? Or using some other feature that IâÂÂm not aware of? Bonus points if thereâÂÂs a way to control the order in which the colours are applied; e.g., specifying an order and then click on each object in turn to apply each swatch being âÂÂiteratedâ through in that order.
(I would prefer to avoid having to script it, but I will if thereâÂÂs no other way.)
adobe-illustrator
asked Aug 6 at 19:17
Janus Bahs Jacquet
1,6411019
1,6411019
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
This script RandomSwatchesFill.jsx does exactly that, selecting all the shapes and all the swatches:
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++)
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;
If you download it change the extension from .js to .jsx
Thank you for that! Accepting that there is probably no GUI-based way to do this easily, I adapted this script to use a user-defined swatch group (instead of selected swatches) and iterate through them in order (instead of choosing one at random). Works perfectly well!
â Janus Bahs Jacquet
Aug 7 at 17:10
@JanusBahsJacquet a script can have a gui
â joojaa
Aug 7 at 18:00
@joojaa I meant the built-in Illustrator GUI-driven functions available through menus and panels, obviously.
â Janus Bahs Jacquet
Aug 7 at 18:02
@JanusBahsJacquet you can make the script appear in a menu. You cant expect illustrator to do much things since it has no concept of parametric design.
â joojaa
Aug 7 at 19:12
add a comment |Â
up vote
0
down vote
accepted
The script posted/linked to by Danielillo does most of what I was looking for. I used it as the basis for the following script, which asks the user for the name of the swatch group to use, and then iterates through the selected objects and the swatches in the named swatch group, applying the current colour to the current object.
(The objects I had needed to have their stroke, rather than their fill, changed, so I also changed that. To colour the fill instead of the stroke, replace strokeColor
with fillColor
.)
var selected = app.activeDocument.selection;
var doc = app.activeDocument;
var swatchIndex = 0;
if (selected instanceof Array)
title = prompt("Please enter the name of the swatch group containing the colours to apply.", "");
if (title)
swatches = doc.swatchGroups.getByName(title).getAllSwatches();
if (swatches.length != 0)
for (i = 0, j = selected.length; i < j; i++)
item = selected[i];
if (swatchIndex >= swatches.length) swatchIndex = 0;
if (item.typename == "CompoundPathItem")
item = item.pathItems[0];
if (item.typename == "PathItem")
item.strokeColor = swatches[swatchIndex].color;
swatchIndex++;
(The script does not handle exceptions, so if you type in an incorrect swatch group name, youâÂÂll probably just get errors thrown at you.)
Note, your adaptation also switched it to stroke color, not fill color.
â WELZ
Aug 7 at 18:54
@WELZ Forgot to mention that, thanksâÂÂedited!
â Janus Bahs Jacquet
Aug 7 at 18:55
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
This script RandomSwatchesFill.jsx does exactly that, selecting all the shapes and all the swatches:
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++)
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;
If you download it change the extension from .js to .jsx
Thank you for that! Accepting that there is probably no GUI-based way to do this easily, I adapted this script to use a user-defined swatch group (instead of selected swatches) and iterate through them in order (instead of choosing one at random). Works perfectly well!
â Janus Bahs Jacquet
Aug 7 at 17:10
@JanusBahsJacquet a script can have a gui
â joojaa
Aug 7 at 18:00
@joojaa I meant the built-in Illustrator GUI-driven functions available through menus and panels, obviously.
â Janus Bahs Jacquet
Aug 7 at 18:02
@JanusBahsJacquet you can make the script appear in a menu. You cant expect illustrator to do much things since it has no concept of parametric design.
â joojaa
Aug 7 at 19:12
add a comment |Â
up vote
3
down vote
This script RandomSwatchesFill.jsx does exactly that, selecting all the shapes and all the swatches:
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++)
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;
If you download it change the extension from .js to .jsx
Thank you for that! Accepting that there is probably no GUI-based way to do this easily, I adapted this script to use a user-defined swatch group (instead of selected swatches) and iterate through them in order (instead of choosing one at random). Works perfectly well!
â Janus Bahs Jacquet
Aug 7 at 17:10
@JanusBahsJacquet a script can have a gui
â joojaa
Aug 7 at 18:00
@joojaa I meant the built-in Illustrator GUI-driven functions available through menus and panels, obviously.
â Janus Bahs Jacquet
Aug 7 at 18:02
@JanusBahsJacquet you can make the script appear in a menu. You cant expect illustrator to do much things since it has no concept of parametric design.
â joojaa
Aug 7 at 19:12
add a comment |Â
up vote
3
down vote
up vote
3
down vote
This script RandomSwatchesFill.jsx does exactly that, selecting all the shapes and all the swatches:
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++)
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;
If you download it change the extension from .js to .jsx
This script RandomSwatchesFill.jsx does exactly that, selecting all the shapes and all the swatches:
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++)
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;
If you download it change the extension from .js to .jsx
edited Aug 6 at 21:22
answered Aug 6 at 20:49
Danielillo
10.1k11345
10.1k11345
Thank you for that! Accepting that there is probably no GUI-based way to do this easily, I adapted this script to use a user-defined swatch group (instead of selected swatches) and iterate through them in order (instead of choosing one at random). Works perfectly well!
â Janus Bahs Jacquet
Aug 7 at 17:10
@JanusBahsJacquet a script can have a gui
â joojaa
Aug 7 at 18:00
@joojaa I meant the built-in Illustrator GUI-driven functions available through menus and panels, obviously.
â Janus Bahs Jacquet
Aug 7 at 18:02
@JanusBahsJacquet you can make the script appear in a menu. You cant expect illustrator to do much things since it has no concept of parametric design.
â joojaa
Aug 7 at 19:12
add a comment |Â
Thank you for that! Accepting that there is probably no GUI-based way to do this easily, I adapted this script to use a user-defined swatch group (instead of selected swatches) and iterate through them in order (instead of choosing one at random). Works perfectly well!
â Janus Bahs Jacquet
Aug 7 at 17:10
@JanusBahsJacquet a script can have a gui
â joojaa
Aug 7 at 18:00
@joojaa I meant the built-in Illustrator GUI-driven functions available through menus and panels, obviously.
â Janus Bahs Jacquet
Aug 7 at 18:02
@JanusBahsJacquet you can make the script appear in a menu. You cant expect illustrator to do much things since it has no concept of parametric design.
â joojaa
Aug 7 at 19:12
Thank you for that! Accepting that there is probably no GUI-based way to do this easily, I adapted this script to use a user-defined swatch group (instead of selected swatches) and iterate through them in order (instead of choosing one at random). Works perfectly well!
â Janus Bahs Jacquet
Aug 7 at 17:10
Thank you for that! Accepting that there is probably no GUI-based way to do this easily, I adapted this script to use a user-defined swatch group (instead of selected swatches) and iterate through them in order (instead of choosing one at random). Works perfectly well!
â Janus Bahs Jacquet
Aug 7 at 17:10
@JanusBahsJacquet a script can have a gui
â joojaa
Aug 7 at 18:00
@JanusBahsJacquet a script can have a gui
â joojaa
Aug 7 at 18:00
@joojaa I meant the built-in Illustrator GUI-driven functions available through menus and panels, obviously.
â Janus Bahs Jacquet
Aug 7 at 18:02
@joojaa I meant the built-in Illustrator GUI-driven functions available through menus and panels, obviously.
â Janus Bahs Jacquet
Aug 7 at 18:02
@JanusBahsJacquet you can make the script appear in a menu. You cant expect illustrator to do much things since it has no concept of parametric design.
â joojaa
Aug 7 at 19:12
@JanusBahsJacquet you can make the script appear in a menu. You cant expect illustrator to do much things since it has no concept of parametric design.
â joojaa
Aug 7 at 19:12
add a comment |Â
up vote
0
down vote
accepted
The script posted/linked to by Danielillo does most of what I was looking for. I used it as the basis for the following script, which asks the user for the name of the swatch group to use, and then iterates through the selected objects and the swatches in the named swatch group, applying the current colour to the current object.
(The objects I had needed to have their stroke, rather than their fill, changed, so I also changed that. To colour the fill instead of the stroke, replace strokeColor
with fillColor
.)
var selected = app.activeDocument.selection;
var doc = app.activeDocument;
var swatchIndex = 0;
if (selected instanceof Array)
title = prompt("Please enter the name of the swatch group containing the colours to apply.", "");
if (title)
swatches = doc.swatchGroups.getByName(title).getAllSwatches();
if (swatches.length != 0)
for (i = 0, j = selected.length; i < j; i++)
item = selected[i];
if (swatchIndex >= swatches.length) swatchIndex = 0;
if (item.typename == "CompoundPathItem")
item = item.pathItems[0];
if (item.typename == "PathItem")
item.strokeColor = swatches[swatchIndex].color;
swatchIndex++;
(The script does not handle exceptions, so if you type in an incorrect swatch group name, youâÂÂll probably just get errors thrown at you.)
Note, your adaptation also switched it to stroke color, not fill color.
â WELZ
Aug 7 at 18:54
@WELZ Forgot to mention that, thanksâÂÂedited!
â Janus Bahs Jacquet
Aug 7 at 18:55
add a comment |Â
up vote
0
down vote
accepted
The script posted/linked to by Danielillo does most of what I was looking for. I used it as the basis for the following script, which asks the user for the name of the swatch group to use, and then iterates through the selected objects and the swatches in the named swatch group, applying the current colour to the current object.
(The objects I had needed to have their stroke, rather than their fill, changed, so I also changed that. To colour the fill instead of the stroke, replace strokeColor
with fillColor
.)
var selected = app.activeDocument.selection;
var doc = app.activeDocument;
var swatchIndex = 0;
if (selected instanceof Array)
title = prompt("Please enter the name of the swatch group containing the colours to apply.", "");
if (title)
swatches = doc.swatchGroups.getByName(title).getAllSwatches();
if (swatches.length != 0)
for (i = 0, j = selected.length; i < j; i++)
item = selected[i];
if (swatchIndex >= swatches.length) swatchIndex = 0;
if (item.typename == "CompoundPathItem")
item = item.pathItems[0];
if (item.typename == "PathItem")
item.strokeColor = swatches[swatchIndex].color;
swatchIndex++;
(The script does not handle exceptions, so if you type in an incorrect swatch group name, youâÂÂll probably just get errors thrown at you.)
Note, your adaptation also switched it to stroke color, not fill color.
â WELZ
Aug 7 at 18:54
@WELZ Forgot to mention that, thanksâÂÂedited!
â Janus Bahs Jacquet
Aug 7 at 18:55
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
The script posted/linked to by Danielillo does most of what I was looking for. I used it as the basis for the following script, which asks the user for the name of the swatch group to use, and then iterates through the selected objects and the swatches in the named swatch group, applying the current colour to the current object.
(The objects I had needed to have their stroke, rather than their fill, changed, so I also changed that. To colour the fill instead of the stroke, replace strokeColor
with fillColor
.)
var selected = app.activeDocument.selection;
var doc = app.activeDocument;
var swatchIndex = 0;
if (selected instanceof Array)
title = prompt("Please enter the name of the swatch group containing the colours to apply.", "");
if (title)
swatches = doc.swatchGroups.getByName(title).getAllSwatches();
if (swatches.length != 0)
for (i = 0, j = selected.length; i < j; i++)
item = selected[i];
if (swatchIndex >= swatches.length) swatchIndex = 0;
if (item.typename == "CompoundPathItem")
item = item.pathItems[0];
if (item.typename == "PathItem")
item.strokeColor = swatches[swatchIndex].color;
swatchIndex++;
(The script does not handle exceptions, so if you type in an incorrect swatch group name, youâÂÂll probably just get errors thrown at you.)
The script posted/linked to by Danielillo does most of what I was looking for. I used it as the basis for the following script, which asks the user for the name of the swatch group to use, and then iterates through the selected objects and the swatches in the named swatch group, applying the current colour to the current object.
(The objects I had needed to have their stroke, rather than their fill, changed, so I also changed that. To colour the fill instead of the stroke, replace strokeColor
with fillColor
.)
var selected = app.activeDocument.selection;
var doc = app.activeDocument;
var swatchIndex = 0;
if (selected instanceof Array)
title = prompt("Please enter the name of the swatch group containing the colours to apply.", "");
if (title)
swatches = doc.swatchGroups.getByName(title).getAllSwatches();
if (swatches.length != 0)
for (i = 0, j = selected.length; i < j; i++)
item = selected[i];
if (swatchIndex >= swatches.length) swatchIndex = 0;
if (item.typename == "CompoundPathItem")
item = item.pathItems[0];
if (item.typename == "PathItem")
item.strokeColor = swatches[swatchIndex].color;
swatchIndex++;
(The script does not handle exceptions, so if you type in an incorrect swatch group name, youâÂÂll probably just get errors thrown at you.)
edited Aug 7 at 18:55
answered Aug 7 at 17:23
Janus Bahs Jacquet
1,6411019
1,6411019
Note, your adaptation also switched it to stroke color, not fill color.
â WELZ
Aug 7 at 18:54
@WELZ Forgot to mention that, thanksâÂÂedited!
â Janus Bahs Jacquet
Aug 7 at 18:55
add a comment |Â
Note, your adaptation also switched it to stroke color, not fill color.
â WELZ
Aug 7 at 18:54
@WELZ Forgot to mention that, thanksâÂÂedited!
â Janus Bahs Jacquet
Aug 7 at 18:55
Note, your adaptation also switched it to stroke color, not fill color.
â WELZ
Aug 7 at 18:54
Note, your adaptation also switched it to stroke color, not fill color.
â WELZ
Aug 7 at 18:54
@WELZ Forgot to mention that, thanksâÂÂedited!
â Janus Bahs Jacquet
Aug 7 at 18:55
@WELZ Forgot to mention that, thanksâÂÂedited!
â Janus Bahs Jacquet
Aug 7 at 18:55
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgraphicdesign.stackexchange.com%2fquestions%2f113526%2frecolor-artwork-single-swatch-to-multiple-swatches%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password