Copy link to clipboard
Copied
The client has provide me his own color palette in .XML format, I don't know how to import these colors or is there any other options to import into illustrator.
Please help me resolve this issue.
Moderator: Moved from Adobe Creative Cloud to Illustrator
Copy link to clipboard
Copied
There is no such functionality. You would need to create a script that converts the values to ASE or whatever so they can be imported into the color palette.
Mylenium
Copy link to clipboard
Copied
You could try if any other CC app can make anything out of the XML and then create swatches from there and put them into the CC libraries to transfer them to Illustrator.
I would try Dreamweaver or XD (and maybe take a look at XD plugins if it still doesn't work.
Copy link to clipboard
Copied
Hi Praveen,
I agree with Mylenium, there is no way of doing this directly in Illustrator, however, it might be possible through scripting. Hence, I am moving this discussion to Illustrator Scripting community, so that you can get some more responses from our scripting experts.
You can also check out some suggestions shared on this similar discussion : Importing Color to Swatch Library from Text File​ and see if that works.
Regards,
Srishti
Copy link to clipboard
Copied
The XML file should be using colors that are valid under html. Those colors should be easily duplicated in the AI or PS color pallets. There are fields for pretty much all of them built in.
For example...
"background-color: rgb(52,0,246);"
....is simply...
R: 52
G: 0
B: 246
...in AI's color pallet and...
"color: #3400f6;"
..is just 3400f6 in the # field on the bottom of the color pallet.
If you need help discerning what the colors are in the code, post it here and I should be able to separate them out pretty easily for you.
Copy link to clipboard
Copied
Can you show pice of your XML?
Here is an example code, Work with XML.
var colour =
<root>
<color id="clr1">
<cyan>80</cyan>
<magenta>30</magenta>
<yellow>0</yellow>
<black>0</black>
</color>
<color id="clr2">
<cyan>80</cyan>
<magenta>30</magenta>
<yellow>0</yellow>
<black>0</black>
</color>
</root>;
var xml = new XML(colour);
var clr = new CMYKColor();
clr.cyan = Number(xml.color.(@id=="clr1").cyan);
clr.magenta = Number(xml.color.(@id=="clr1").magenta);
clr.yellow = Number(xml.color.(@id=="clr1").yellow);
clr.black = Number(xml.color.(@id=="clr1").black);
var newSwatch = app.activeDocument.swatches.add();
newSwatch.color = clr;
Copy link to clipboard
Copied
There's gotta be more to the code than that, isn't there?
Right now, they only have code for one color (even though they create ids for two)
CMYK: 80, 30, 0, 0
Copy link to clipboard
Copied
Yeah, this code creates only one color, if you want to add more, the best shot will be to close this in a for loop.
Copy link to clipboard
Copied
Oops, nevermind, I mistook Ten A for the original poster.
Copy link to clipboard
Copied
No problem, Jon. (^_^)/
I added more detail, How to determine loop length and do looping.
However, It's necessary to know XML structure when we read it and processing children.
var colour =
<root>
<color id="clr1">
<cyan>80</cyan>
<magenta>30</magenta>
<yellow>0</yellow>
<black>0</black>
</color>
<color id="clr2">
<cyan>50</cyan>
<magenta>0</magenta>
<yellow>100</yellow>
<black>0</black>
</color>
<color id="clr3">
<cyan>0</cyan>
<magenta>50</magenta>
<yellow>100</yellow>
<black>0</black>
</color>
<color id="clr4">
<cyan>00</cyan>
<magenta>40</magenta>
<yellow>20</yellow>
<black>35</black>
</color>
<color id="clr5">
<cyan>0</cyan>
<magenta>0</magenta>
<yellow>50</yellow>
<black>50</black>
</color>
</root>;
var xml = new XML(colour);
var num = xml.children().length();
var clr, newSwatch;
for (var i=0;i<num;i++){
clr = new CMYKColor();
clr.cyan = Number(xml.children().cyan);
clr.magenta = Number(xml.children().magenta);
clr.yellow = Number(xml.children().yellow);
clr.black = Number(xml.children().black);
newSwatch = app.activeDocument.swatches.add();
newSwatch.color = clr;
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now