Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
1

Can I automatically give every subsequent letter a different color for a batch of text designs?

Community Beginner ,
Oct 04, 2023 Oct 04, 2023

Hello, 

 

I'm searching help for a task, I want to generate a batch of text images in which each individual letter is colored differently. If I create a text and then put a different color on each letter there is no problem but if I want to use variables to produce different text it applies the same effect of the first letter to the full text, this is forcing me to enter each Ai file and re color each letter. I'm curious if there's a method or a script to automatically ensure that each successive letter in every text image receives a unique color. For example, I want the first letter of the text to be bleu, second to be yellow, thirt to be pink, and then it repeats, forth letter to be bleu, fifth to be yellow, sixth to be pink, etc

 

Thank you in advance

TOPICS
Scripting
723
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guide ,
Oct 04, 2023 Oct 04, 2023
  1. Is there a set of colors to choose from, or should the script generate the colors? 
  2. Should the color be different from the color of the preceding letter, or all preceding letters in a body of text? 
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 04, 2023 Oct 04, 2023

Hi, I was thinking on using specific colors (not randomly generated), and each letter should be different in a sequancial mode, like for example for word "The Bank", using for example 3 colors (green, pink, red), it should be "T" green, "h" pink, "e" red, "B" green again, "a" pink again, "n" red again, "k" green and so on.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Oct 04, 2023 Oct 04, 2023

Create a color group with the desired colors in the desired order, select the color group and the text, and run

var colors = app.activeDocument.swatches.getSelected();
var chars = app.selection[0].characters;
var counter = 0;
for (var i = 0; i < chars.length; i++) {
    if (chars[i].contents != " ") {
        chars[i].characterAttributes.fillColor = colors[counter].color;
        if (counter < colors.length - 1) counter++;
        else counter = 0;
    }
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 04, 2023 Oct 04, 2023

Yey! Thank you very much, exactly what I needed 🙂 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 04, 2023 Oct 04, 2023
LATEST

Is it possible to have something like this for each word, each line of text (if there is an ENTER) and each sentence?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 04, 2023 Oct 04, 2023

@Miamore 

 

I've moved your post to the Illustrator forum for you, as the PS script is not likely to work in Illustrator.

 

For reference, here is the image and link to the Photoshop thread:

 

janee_0-1696443150086.pngexpand image

https://community.adobe.com/t5/photoshop-ecosystem-discussions/can-you-automatically-give-every-subs...

 

Jane

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 04, 2023 Oct 04, 2023

Hi, thank you, yes I noted that so I have created this new thread, only that now I am not able to comment in the one that is for phorothop, I wante to post this

"Also for your script, its trying to apply a color for the spaces too, so for example if I want to use three different colors (bleu, yellow, pink) for the phrase "The Bank", 1st letter will be bleu, 2nd will be yellow, 3rd will be pink, the space is taking in account as a character so it is trying to put it as bleu, so the letter B (4th letter but 5th in placement if we take in account the space), will be yellow instead of bleu, is there a way to adjust this please?"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 04, 2023 Oct 04, 2023

Femkes script will work as you want.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 04, 2023 Oct 04, 2023

Ah yes, this particular question was intended to go to the original thread (the photoshop one), it was open at the time I asked the 1st question but then I created a new thread for Illustator and it was moved here and the photoshop one was marked as solved so I can't ask for adjustements on the provided scipt there (I guess I will need to open a new one asking for that)

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 04, 2023 Oct 04, 2023

I answered in your other thread here:

 

https://community.adobe.com/t5/illustrator-discussions/re-can-you-automatically-give-every-subsequen...

 

But as it obviously is associated, here you can get a script, kindly provided by Sky Chaser High:

 

Random Text Colour

 

Options available: by word, character or sentence. You may try to modify it, so it suits your needs.

 

And of course, try Femke's very good approach.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 04, 2023 Oct 04, 2023

The Random Text Colour script is not exactly what I want because its giving random colors, but Femke's one works well

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines