This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Danaan Clarke
Posted Jun 07 - Read on Facebook

Why doesn't this conditional work? Trying to get it to toggle between red and blue

layer = new Layer

layer.onClick ->
if layer.backgroundColor is "red"
layer.backgroundColor = "blue"
else
layer.backgroundColor = "red"

print layer.backgroundColor

3 Comments

Steve Ruiz

You have to check layer.backgroundColor.color. :/

Jordan Robert Dobson

Probably because background color values automatically get converted to a Color object.

https://framer.com/docs/#color.color

You'll maybe want to use hex values.

Danaan Clarke

Ok, that makes sense. I'm new to framer and was banging my head against this. Thank you both!

Read the entire post on Facebook