Unable to retrieve swatch color details
Hi,
I have a script which show the color details of the selected swatches. I am able to get the color details of the default swatches


However, when I tried to add swatches from library..

the color details is blank..

Is there a way to retireve those data?
Here's my code btw,
function getSwatchData(){
var swatches = []
var selectedSwatches = app.activeDocument.swatches.getSelected();
for (var i = 0; i < selectedSwatches.length; i++) {
var swatchData = {}
swatchData.name = selectedSwatches[i].name;
swatchData.color = {};
if(selectedSwatches[i].color){
swatchData.color.black = selectedSwatches[i].color.black;
swatchData.color.cyan = selectedSwatches[i].color.cyan;
swatchData.color.magenta = selectedSwatches[i].color.magenta;
swatchData.color.yellow = selectedSwatches[i].color.yellow;
swatchData.color.l = selectedSwatches[i].color.l;
swatchData.color.a = selectedSwatches[i].color.a;
swatchData.color.b = selectedSwatches[i].color.b;
swatchData.color.red = selectedSwatches[i].color.red;
swatchData.color.green = selectedSwatches[i].color.green;
swatchData.color.blue = selectedSwatches[i].color.blue;
}
swatches.push(swatchData);
}
return JSON.stringify(swatches);
}TIA,
Hanna
