Skip to main content
Question

Color variables vs Variables chnging Component states - what is the best practice?

  • January 14, 2025
  • 1 reply
  • 28 views

Yurin_Dima

Hello everyone,

I’m new to the community and wanted to hear your thoughts on using variables.

From my understanding, you can achieve the same result in two ways when working with variables. For example, I want to create both a Dark and Light Theme for my screen. I could create color variables and then decide that everything green will turn blue in the other theme, and vice versa.

Alternatively, if I’m working with components, I could create two variations for each component, naming them Light and Dark Theme, and use a string variable to switch between the variants accordingly.

Which approach do you think is more appropriate? What are the pros and cons of each? When might it be better to use one over the other?

I’d appreciate any thoughts or questions, even if it’s to point out that my understanding is incorrect and it should be done in a third way :)….

1 reply

johntk22
  • New Participant
  • 11 replies
  • January 15, 2025

For color-based changes, the color variable approach is best and if your themes have different layout then component variation is more appropriate.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings