Site icon UXMISFIT.COM

Color Variables in Sketch – Best Practices

Color Variables in Sketch

Color Variables introduced in Sketch69 replaced document colors. They are the basic block that you need to create your UI Library for Design System. You create them and apply everywhere where you need a color – Fill, Border, Layer Styles, or even Text Styles. When you change variable color, it will be updated immediately in every instance it was used.

Color Variables – How to use them?

You may use color variables inside your document or get them from the library. They work in a similar way as layer styles, but they are more independent.

You may use the same Color Variable for fill, stroke, or even text. Thanks to this, your design will be more consistent. Now you do not have to update 3 or more styles when it comes to color change. Everything is in one place – the variable!

How to create Color Variable

There are two ways to create Color Variable. The first one is to click the “Create Color Variable” button in the color picker popover (Inspector Panel).

 

The second method is related to the new Components View. Simply go to Color Variables Tab and click the “+” button to create yours.

How to insert Color Variable

There are three ways to insert existing Color variables. The first one – from the inspector Panel near the color swatch, there is a new tiny button. Click it, and you will be able to choose a tone from the existing color variables – also ones available from libraries.

 

The next way to apply Color Variable is to press “C”. Thanks to this new Insert Window will appear. You have to search color or choose the tab with Color Variables and pick the needed one. You may drag and drop the Color Variable to fill or stroke in the Inspector Panel from the Insert Window.

The third one creates a shape with Color Variable. Go to the Color Variable tab in the new Components View, select the element with color and press the button “Insert Shape with Color.” This method shows only color variables inside the document.

 

How to modify Color Variable

First method to edit Color Variable is go to the new Components View and select the needed tab. Select the color element you would like to edit and choose the new tone (manipulate the values in the Inspector Panel). Changes will be applied immediately – no need to click “update” or something else.

The second method is to modify Color Variable directly from the Shape Layer you use it. Go to Inspector Panel and click on the color swatch. When the Color Popup will appear find the button “Edit Varaible” and modify the color. When you finish press “Update. That’s all!

 

 

How to delete or rename Color Variable

Removing Color Variable is very simple. Just click right on the element in the Components View and pick the “Delete” option. There are also other options like group or rename – everything you except from the contextual menu.

Color Variables – Best Practices

The feature is new, and there is still a lot to discover here. I am also sure that Sketch Team will develop Color Variable in future releases. However, I already have techniques that will help you work efficiently:

Optimize with the good naming convention

Never ever use names like Red, Yellow, Green, or Blue in Layer Styles and Color Variables. Give additional meaning to colors – let them be self-documented ones.

Use names like Primary, Secondary, Warning, Error, Success, Dark, Medium, Light, etc. They are universal and help to discover their purpose.

What’s more, some projects go through rebranding, and you will only have to change a few color tones, without modifying Color Variable names.

If you have a few variations of the Primary Color (alternative tone, or opacity), simply group them using “/” in Color Variable Name. For example: “Primary/Primary 50” or “Secondary/Secondary Alternative 3”.
Thanks to this you will see them in one place.

 

Use Variables instead of basic Layout Styles

If you have Layout Styles, that include only colors. Change them into Color Variables.

If your team is new to Color Variables, you may make the change in a few phases. For example: in the first step, bind Color Variable with Layer Styles. When your team will be ready, and old Layer Styles will not be used in the components – delete them.

 

Bind Variables between Layer Styles with Text Styles

To maintain consistency and always use the same colors for Layers with Shapes or Layer Styles, use the same Color Variables in Text Styles.

It is very simple to add Color Variable to Text Style because it works in the same way as in Layer Styles!

 

Manage them in Components View

Think of Components View as the new center for managing your Components – Symbols, Text and Layer Styles, and obviously Color Variables.

You may create new Color Variables while working in standard Canvas, but the whole management should be done in Components View. You may change colors of the variable, rename them, group, or delete.

To conclude

Color Variables is the feature that changes our workflow in Sketch. It simplifies it and makes it easier to create a consistent design. Now you know how to use them in your documents.

Do you have other tips? Please share them to help designers boost their workflow!

 

By the way…

If you start a new project or would like to organize your UI Library in Figma — do not waste your time creating everything from scratch. Feel free to use the Prime — Design System Kit. It helps you design UI with the best Figma techniques — Component Properties, Variants, Auto Layout and more.
See Prime in action.

To make it easier there is a gift 🎁 - Use UXMISFIT10 offer code to get 10% Off.

 
You can also Create User Flows faster in Figma & Sketch — With SQUID you can create User Flows directly in your favorite design tool. You may style them to your project brand within a couple of clicks. Prepare all kind of diagrams in minutes. See how it works.