Created
July 6, 2016 06:12
-
-
Save ten-A/e0119a9fe9649bfe40029b743c993b12 to your computer and use it in GitHub Desktop.
Retrieve layers color value.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Need to include stdlibs in xtools. You can reference below link. | |
//http://ps-scripts.sourceforge.net/xtools.html | |
#include "stdlib.js" | |
var desc = Stdlib.getLayerDescriptor( | |
app.activeDocument, | |
app.activeDocument.activeLayer | |
); | |
var adjs = desc.getList(cTID('Adjs')); | |
var clrDesc = adjs.getObjectValue(0); | |
var color= clrDesc.getObjectValue(cTID('Clr ')); | |
var r = Math.round(color.getDouble(cTID('Rd '))); | |
var g = Math.round(color.getDouble(cTID('Grn '))); | |
var b = Math.round(color.getDouble(cTID('Bl '))); | |
alert(r+" "+g+" "+b); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment