Copy link to clipboard
Copied
I need a Photoshop action/script for a file which contains around 50 text layers. I need the action/script to alter the colour of each text layer and apply new colours to each one individually. Each time I run the action, the script should randomise the colours again.
The new colours will be preset from a group of colours e.g.
"Colour group one": #000000, #f3f3f3, #76f8f7, #333333, #454566, #d87d56
"Colour group two": #111111, #c7c8c7, #f9h9d9, #999999, #d3d2d2, #a8aha8
Etc....
Example:
I have a file containing 50 text layers. I want to change all of the text layers to the "Colour Group One" colours. I run the script/action and each text layer will have one of the colours from "Colour Group One". Each time I run the action, each text layer will change colours again.
I hope this is clear but understand that it might not be! (I have add an example image to text color change.)
Thanks in advance!
There you go buddy.
PSD Script: Set Random text color from given array
Simply add hex colours to colorArray variable and you should be golden
// Script applies random color from given color array
// to all text layers in the document.
//
// by Tomas Sinkunas www.rendertom.com
(function(){
#target photoshop
// Define HEX colors separated by comma
var colorArray = ["#000000", "#f3f3f3", "#76f8f7", "#333333", "#454566", "#d87d56"];
// Collect all text layers in the document
var textLa
...
Copy link to clipboard
Copied
Hi mirza5313,
Do you search for help to writing a script?
Or do you search for someone who is writing the script for you?
In both cases: please upload an example file for testing.
Copy link to clipboard
Copied
There you go buddy.
PSD Script: Set Random text color from given array
Simply add hex colours to colorArray variable and you should be golden
// Script applies random color from given color array
// to all text layers in the document.
//
// by Tomas Sinkunas www.rendertom.com
(function(){
#target photoshop
// Define HEX colors separated by comma
var colorArray = ["#000000", "#f3f3f3", "#76f8f7", "#333333", "#454566", "#d87d56"];
// Collect all text layers in the document
var textLayers = getTextLayers(app.activeDocument);
// Loop through all text layers in the document
for (var t = 0, tl = textLayers.length; t < tl ; t ++) {
// Get random color from color array
var randomColor = colorArray[Math.floor(Math.random() * colorArray.length)];
// Remove pound sing from the color value
if (randomColor.charAt(0) === "#")
randomColor = randomColor.substr(1);
// Initiate new color
var textColor = new SolidColor;
textColor.rgb.hexValue = randomColor;
// Set text Layer Color
textLayers[t].textItem.color = textColor;
}
function getTextLayers (doc, layers) {
layers = layers || [];
for (var i = 0, il = doc.layers.length; i < il; i ++) {
if (doc.layers[i].typename == "LayerSet") {
getTextLayers(doc.layers[i], layers)
} else {
if (doc.layers[i].kind == "LayerKind.TEXT") {
layers.push(doc.layers[i])
}
}
}
return layers
}
})();
Copy link to clipboard
Copied
Thanks Tomas Sinkunas for your prompt reply and script... This is amazing script just what i wanted.....
Thanks a lot!!!
Copy link to clipboard
Copied
Hi Tomas,
Could you please show me how to do this for selected text layers? Only for the text layers inside a folder.
Also, without adding colors randomly, I need it to be the order of Hexcode.
I'm really be grateful if you can show me how to do this. TIA.
Copy link to clipboard
Copied
Heey Can this script pick colors from pictures instead of adding the hex manually ? If there any script that could take colors from the picture in the design and put it on text ?