How to check the layer's color?

I want to check the layer's color in the photoshop script (javascript). I'm writing a file exporter and I want to do one thing or another depending on the layer's color.

I want to check the layer's color in the photoshop script (javascript). I'm writing a file exporter and I want to do one thing or another depending on the layer's color.
// 2013, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var layerDesc = executeActionGet(ref);
alert (typeIDToStringID(layerDesc.getEnumerationValue(stringIDToTypeID("color"))));
};
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.