Download Project File

How To Create a Color Picker Effects in After Effects

In this post, I will show you how to create a color picker effect in After Effects. So without any further ado, let’s dive right in!

Alright, so we are in After Effects and first let me show you what we are going to create.

I have a null object right here.

Knoll in After Effects

If I click, drag and move it, watch what happens when I hover over any of these colors.

So if I hover over green, my logo becomes green.

knoll hover over green color changing logo to green in After Effects

If I hover over blue, it becomes blue.

Hover over blue color with knoll in After Effects

Essentially, it is like a color picker.

Now let me show you how to set this up in After Effects.

For this setup, I have a POINT layer that is a null object.

Point layer knoll in After Effects

Then I have a colors shape layer that has all of our colors.

Colors shape layer in After Effects

And we also have our UKRAMEDIA.COM logo shape layer.

Ukramedia logo shape layer in After Effects

The UKRAMEDIA.COM logo shape layer has a color option inside that allows me to change the back shape color of our UKRAMEDIA.COM logo.

Ukramedia.com logo color control

So whatever color I pick inside of my color options, it will automatically change my UKRAMEDIA.COM logo to that color.

Picking color in After Effects

And that is where we are going to start.

First, I am going to ALT+CLICK (OPT+CLICK on a MAC) on the color stopwatch icon to active the expression.

alt click on the stopwatch icon in After Effects

Then I am going to set some variable inside of the text box.

Text box in After Effects

First Variable

The first variable is going to be color picker, so I am going to say colorPicker = and then I am going to tell it to be the position of our point null object by pick-whipping to the position of the POINT layer like so:

colorPicker = thisComp.layer(“POINT”).transform.position;

Position of the point null in After Effectsposition of Point layer in After Effects

Second Variable

The second variable is going to be colors = and I will tell it to be the COLORS shape layer by pick-whipping to it like so:

colors = thisComp.layer(“COLORS”);

Second variable color in After Effects Color Shape layer in Adobe After Effects

Writing Expression

Next, we are going to write our expression. To do that, we are going to go to the Expression Helper -> Layer -> General -> SampleImage(point, radius = [.5, .5], postEffect = true, t = time)

Expression helper in After Effects
When we click on the SampleImage(point, radius = [.5, .5], postEffect = true, t = time), it will bring that expression into our expression window.

Our Expression in After Effects

Next, we are going to do some adjustments to our code.

colorPicker = thisComp.layer(“POINT”).transform.position;

colors = thisComp.layer(“COLORS”);

 

SampleImage(point, radius = [.5, .5], postEffect = true, t = time)

So I am going to replace point to colorPicker.

BEFORE:

colorPicker = thisComp.layer(“POINT”).transform.position;

colors = thisComp.layer(“COLORS”);

 

SampleImage(point, radius = [.5, .5], postEffect = true, t = time)

AFTER:

colorPicker = thisComp.layer(“POINT”).transform.position;

colors = thisComp.layer(“COLORS”);

 

SampleImage(colorPicker, radius = [.5, .5], postEffect = true, t = time)

Now we have to do one more thing. We need to place our colors right before the expression like so:

BEFORE:

colorPicker = thisComp.layer(“POINT”).transform.position;

colors = thisComp.layer(“COLORS”);

 

SampleImage(colorPicker, radius = [.5, .5], postEffect = true, t = time)

AFTER:

colorPicker = thisComp.layer(“POINT”).transform.position;

colors = thisComp.layer(“COLORS”);

 

colors.SampleImage(colorPicker, radius = [.5, .5], postEffect = true, t = time)

Now if I let go, you can see that it is successfully grabbing the color from the position of my null object.

grabbing color from null in After Effects

So if I click on our null and move it around over other colors, you can see that it is working well because the logo color is changing.

Clicking and moving around knoll

Now let’s go over a few important things. In the colors.SampleImage(colorPicker, radius = [.5, .5], postEffect = true, t = time) you can see [.5, .5]. That is a sample area, which is our anchor point.

Anchor Point and Sample Area in After Effects

The sample area of that point is .5 pixels both ways (left, right, up, and down). So essentially, the sample area
is one pixel on x and y axis.

So right now it is a tiny point but we can increase it.

Let’s do something more dramatic like 50.

BEFORE:

colorPicker = thisComp.layer(“POINT”).transform.position;

colors = thisComp.layer(“COLORS”);

 

colors.SampleImage(colorPicker, radius = [.5, .5], postEffect = true, t = time)

AFTER:

colorPicker = thisComp.layer(“POINT”).transform.position;

colors = thisComp.layer(“COLORS”);

 

colors.SampleImage(colorPicker, radius = [50, 50], postEffect = true, t = time)

When we do that, we will have a much bigger sampling area and because of that we have a smoother switch between each color, which will lead to a more of a gradual transition.

I hope you found this post useful. If you would like to learn more about Expression and how it can speed up your workflow in After Effects, check out my Learn After Effects Expressions Course.

Download Project File

About the author:

Sergei Prokhnevskiy

Sergei Prokhnevskiy is a Charlotte, NC based motion graphics designer, an online tutor, an entrepreneur, and Adobe MAX Master Speaker. Sergei is known for his quick and practical After Effects tips and tricks on YouTube, where he generated well over 6 million views on his tutorials. He has authored an online video course on After Effects Expressions and developed scripts for After Effects. He is also a former senior motion graphics designer at Fox Sports where he worked on graphics for NFL, Super Bowl, MLB, World Series, College Football, NASCAR, Women’s World Cup, and NASCAR Race Hub. He is very passionate about learning and teaching others.

5 FREE TIME-SAVING TOOLS!

Over 100,000 downloads & counting!

These 5 tools will seriously speed up your workflow and save you hours of wasted time. More than that, they could be the difference between being able to complete a project on time or not!