Skip to main content

Is there a way to keep a string variable aligned with a color variable HEX code, either through aliasing or by another method?


For example:

Color Variable

|Key | Value|

|myColorVar | #FFFFFF|


String Variable

|Key | Value|

|myStringVar | myColorVar variable|


myStringVar = “#FFFFFF


Use case: It would be nice for documentation to be able to automatically keep written HEX colour codes aligned with changes to the colour variables they are documenting.


Thanks for the help!!

Hi @Allen_Chris_CITZ_EX, Thanks for reaching out about this!


Currently, it appears that a string variable cannot reference a color variable in Figma. When creating an alias, a variable can only reference other variables of the same type.

You can find more details here: Create and manage variables - Create an alias


As a side note, this sounds like a fantastic idea for a feature request! If you’re interested, we encourage you to share this suggestion in the “Share an Idea” category.


I also took some time to search our community for any plugins that might help with this, but unfortunately, I haven’t found anything suitable yet.


Let’s hope someone from our community might have some tips or workarounds to share!

If anyone has any suggestions or insights, please feel free to jump in.


Thanks again for reaching out.


Yes, it would be a great feature to access color variables as a text string.


Hi, To ensure it gets the proper attention, I’ve moved this topic to the “Share an Idea” section. Please vote up!


Thanks,


Thanks @Junko3! Appreciate it. I’ll give it a vote.


I’ll work on creating a plugin for this functionality. I’ll make sure to share here once I get it rolling.


I have found this

While it doesn’t link the text content dynamically to the color-variable’s value (so I can change the color variables whenever I want and the codes would update automatically), it can still get the code from the color even if the assigned color is an alias or a color-style.

And at least it enables me to update all the codes with one click.

The down sides are that I have to name the Text layer to $hex and I have to assign the color to the text layer itself. But that’s easy enough to get around with masks or nested components.


Reply