Copy link to clipboard
Copied
i have designs with around 30 colours, with codes like these. #009245 and #ec3744. The colours i use change a lot so i have to individually select all and group each color.
I would like to know if there is already a script for grouping each color fill or adding each color fill to a different layer.
I tried Meta to make one but it did not work :
var doc = app.activeDocument;
var items = doc.pageItems;
var colors = {};
for (var i = 0; i < items.length; i++) {
var item = items[i];
if (item.fillColor) {
var color = item.fillColor.toString();
var hexMatch = color.match(/(\w{6})/g);
if (hexMatch) {
var hexCode = hexMatch[0].toLowerCase();
if (!colors[hexCode]) {
colors[hexCode] = [];
}
colors[hexCode].push(item);
}
}
}
for (var hexCode in colors) {
var layer = doc.layers.add();
layer.name = hexCode;
for (var j = 0; j < colors[hexCode].length; j++) {
colors[hexCode][j].moveToBeginning(layer);
}
}
Is there anything that is already made? I've searched but cant find anything that puts each color fill (in a closed shape or path) into a group or layer
i just found one 🙂
Copy link to clipboard
Copied
Copy link to clipboard
Copied
can you elaborate? can you show before and after screenshots or share sample files?
ok, I see you found your answer
Copy link to clipboard
Copied
thanks , yes 🙂 thanks for checking .. People like you that help others are gentlemen to the extreme. (and gentlewoman) . Thanks
Find more inspiration, events, and resources on the new Adobe Community
Explore Now