Here's a little script that will record color samplers, as I mentioned previously. It will record the samples to a file named colors.txt on your desktop, in a folder called "color samples." Make some color samples and run the script. If you want to add more to the file, clear the color samplers, with the clear all button in the menu bar, add more samples and run the script again. If you want to start over and make a new color sample file, either delete the current colors.txt file, or rename it to save it. Then start the process of setting sample points again.
This script will record RGB values, but can be changed to record HEX.
#target photoshop
var colorFolder = new Folder('~/desktop/color samples/')
var colorFile = new File('~/desktop/color samples/colors.txt')
if(!colorFolder.exists){colorFolder.create()}
var doc = activeDocument;
var colorList = '';
if(colorFile.exists){colorList = readFile (colorFile)};
for(i=0;i<doc.colorSamplers.length;i++){
colorList += doc.colorSamplers[i].color.rgb.red +',' + doc.colorSamplers[i].color.rgb.green + ',' +doc.colorSamplers[i].color.rgb.blue + '\n'
}
writeFile (colorFile, colorList)
function readFile(file) {
if (!file.exists) {
alert( "Cannot find file: " + deodeURI(file.absoluteURI));
}
else{
file.encoding = "UTF8";
file.lineFeed = "unix";
file.open("r", "TEXT", "????");
var str = file.read();
file.close();
return str;
};
};
function writeFile(file,str) {
file.encoding = "UTF8";
file.open("w", "TEXT", "????");
//unicode signature, this is UTF16 but will convert to UTF8 "EF BB BF"
file.write("\uFEFF");
file.lineFeed = "unix";
file.write(str);
file.close();
};