Assigning Number to Color

Is there anyway to assign a number to each color to print out a color by number sheet?

Is there anyway to assign a number to each color to print out a color by number sheet?
Okay here's a script that you can try. There are some things you need to do. You need to enlarge the image using precent. I enlarged it 2400%, so that a one pixel square would be 24 px. In the script, you have to enter the hex values of the colors in the art work and the corosponding number that you want displayed. This script takes a long time to run, as it has to sample so many areas. So try it out on a small image first. Here is my test image:

#target photoshop
var doc = activeDocument;
var step = 24;
var hexVal, colorNum, pts
//Enter hex value of numbers and then the number to be displayed into the below array
var cArray = [['000000',1],
['FFFFFF',2],
['017185',3],
['0000FF',4],
['FF0000',5],
['3CFF00',6]];
for (var k=0;k<doc.height;k+=step){
for( var j=0;j<doc.width;j+=step){
pts = [j+step/2,k+step/2];
hexV = getColor ();
colorNum = findNum()
makeText ();
doc.activeLayer.rasterize (RasterizeType.TEXTCONTENTS)
if(k>0||j>0)(doc.activeLayer.merge())
}
}
function makeText(){
var artLayerRef = doc.artLayers.add()
artLayerRef.kind = LayerKind.TEXT;
var textItemRef = artLayerRef.textItem;
textItemRef.contents = colorNum
textItemRef.size = 25
textItemRef.position= pts
var tCenter = pts[1]-(doc.activeLayer.bounds[1].value+(doc.activeLayer.bounds[3].value-doc.activeLayer.bounds[1].value)/2);
doc.activeLayer.translate (0, tCenter)
textItemRef.justification = Justification.CENTER;
}
function getColor(){
doc.colorSamplers.removeAll();
var cS = doc.colorSamplers.add(pts);
var rgbC = new SolidColor
var c1 = cS.color.rgb.hexValue
return c1
}
function findNum(){
for (i=0;i<cArray.length;i++){
if (hexV == cArray[i][0]){
return cArray[i][1];
}
}
return ' ';
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.