Skip to main content
Participant
August 15, 2018
Answered

Limit colors in AE Essential Graphics Template

  • August 15, 2018
  • 3 replies
  • 5217 views

Hi, I am trying to create some motion text templates in AE. I want it to be easy to use for beginners as imported in Premiere Pro and so I am trying to limit the editing options to the minimum. Only thing that i could not solve is how to limit colors so that in premiere pro , the user could have a choice out of i.e. two or three (brand colors only) of them. Is there any way to achieve that? any expressions maybe?

Correct answer Kyle Hamrick

You could create a few different color schemes, and then use a slider to allow them to select between Look 1, Look 2, Look 3, for example.

Depending on how complicated your template is, you could use multiple instances of the Fill effect, make duplicate versions of a few pieces, of the whole comp, or use Master Properties. Whatever.

Create a slider somewhere, send it to the EGP, and limit it to the number of color options you want. (1-3), for example.

On the opacity for Look 1 (or layers, effects, etc., depending on how you built this thing), you'd add this expression:

var slider = pickwhip to your slider;
if (slider == 1) 100 else 0

Change the 1 to a 2 for the next look, and so on.

It should be noted that this will only detect whole numbers, so if the slider is set to 1.3, for example, it won't detect it. There are some additional functions you can add to the expression if you need it to be more "aware", but with only a few options, this should work fine.

3 replies

granth54436419
Known Participant
April 6, 2022

Alternatively,  this expression applied to the Fill Color allows you to select from a menu of predetermined colors:

if (thisComp.layer("Control").effect("Block Color Selection")("Menu") == 1) {
	hexToRgb("FFAD10");
} else if (thisComp.layer("Control").effect("Block Color Selection")("Menu") == 2) { 
	hexToRgb("0077EE");
} else if (thisComp.layer("Control").effect("Block Color Selection")("Menu") == 3) {
	hexToRgb("66AA88");
} else if(thisComp.layer("Control").effect("Block Color Selection")("Menu") == 4) {
	hexToRgb("FF6633");
} else if(thisComp.layer("Control").effect("Block Color Selection")("Menu") == 5) {
	hexToRgb("AA44BF");
} else {
	value;
}

Add a "Dropdown Menu" selector to the Essential Graphic panel, and supply the color names you want to be displayed.
Then link the menu to the fill.

Inspiring
May 3, 2024

Perhaps a stupid question but my expression has a problem with 'block color selection' as there isnt an effect named this, what should I be changing to this name?

Inspiring
May 3, 2024

Never mind - for anybody with the same question,  add the drop down selector as an effect and rename it to block color selection.

Kyle Hamrick
Community Expert
Kyle HamrickCommunity ExpertCorrect answer
Community Expert
August 15, 2018

You could create a few different color schemes, and then use a slider to allow them to select between Look 1, Look 2, Look 3, for example.

Depending on how complicated your template is, you could use multiple instances of the Fill effect, make duplicate versions of a few pieces, of the whole comp, or use Master Properties. Whatever.

Create a slider somewhere, send it to the EGP, and limit it to the number of color options you want. (1-3), for example.

On the opacity for Look 1 (or layers, effects, etc., depending on how you built this thing), you'd add this expression:

var slider = pickwhip to your slider;
if (slider == 1) 100 else 0

Change the 1 to a 2 for the next look, and so on.

It should be noted that this will only detect whole numbers, so if the slider is set to 1.3, for example, it won't detect it. There are some additional functions you can add to the expression if you need it to be more "aware", but with only a few options, this should work fine.

Mylenium
Legend
August 15, 2018

You cannot limit colors in a generic fashion. Sure, expressions can help to some degree, but you will have to explain where they need to be applied. there simply is no "one fits all" code snippet for that.

Mylenium