Skip to main content
James_Green1
New Participant
September 3, 2024
Question

Change components with light and dark mode

  • September 3, 2024
  • 7 replies
  • 3100 views

Hi all,

I was wondering if it’s possible to change components with the light and dark mode feature. The use case is in my site navigation I want to change the brand logo to the correct version depending on whether the designs are in light or dark mode. I know I could just change it in the properties panel but it would be nice to have it automated so other designers get the correct logo with limited brand knowledge.

Any thoughts or help appreciated
James

This topic has been closed for replies.

7 replies

Raphael_M
Power Member
September 3, 2024

Hi, James. What do you mean by automated? I’m quite confused. You asked if it’s possible to change components and then answered it on your 3rd sentence.

Pavel_Kiselev
Power Member
September 3, 2024

Add a string variable to your light / dark collection modes, something like theme = light | dark.

Make a variant for your logo, name your properties and make sure values are the same as values of your theme var, theme=light and theme=dark.

Finally, bind the logo theme property to variable theme.

And here you go

Raphael_M
Power Member
September 3, 2024

Hmmm. Not sure though if this is the automated, you’ll still be toggling them on the properties panel.

Pavel_Kiselev
Power Member
September 3, 2024

That’s fine to be not the sharpest knife in the drawer 😉

You either switch mode on the frame and then drill down to the logo component to set the proper variant. That’s at least two steps and if you have few components that rely on this logic the process becomes more tedious.

Or you link mode with the variant and it becomes automatic in a way that I only need to enable the proper mode and all the components inside that frame or page adjust themselves automatically.

Makes sense?

James_Green1
New Participant
September 3, 2024

will try your method there Pavel and confirm if this is what I was after

James_Green1
New Participant
September 5, 2024

@Pavel_Kiselev this workes a treat so thanks for taking the time to reply

GoodTech.
New Member
March 11, 2025

Many thanks Pavel! Simple and to-the-point.