Change all text color in text box
Hi guys and greetings from Norway!
I've got something that is almost working. I want to change the text color in a selected box from e.g. black to white.
Previously I have this script from another post at this site. However, it's a problem. It only changes the first paragraph. How do I make it cycle through all the text?
Pseudo-code could be either something that selects all text and then changes color of it, or something that counts the paragraphs and then cycle through them one by one. Any ideas on how to solve this?
Code:
var i, p, color;
for (i=0; i<app.selection[0].paragraphs.length; i++) {
p = app.selection[0].lines;
color = makeColor("C=0 M=0 Y=0 K=0", ColorSpace.CMYK, ColorModel.process, [0, 0, 0, 0]);
p.fillColor = color;
}
function makeColor(colorName, colorSpace, colorModel, colorValue) {
var doc = app.activeDocument;
var color = doc.colors.item(colorName);
if (!color.isValid) {
color = doc.colors.add({name: colorName, space: colorSpace, model: colorModel, colorValue: colorValue});
}
return color;
}
