In a previous post, we briefly talked about setting up shared styles. We had a primary brand color and a secondary brand color and made them their own styles. Today, I want to go more in depth about why you want to set these up, how you want to create them, and how you want to use them.
Shared styles lay down the rules for the rest of your designs. With styles, we’ll set the primary colors of the brand, set the typographic rules, as well as set basic rules for buttons, links, etc. The benefit of setting up styles right from the beginning is that we only need to edit a small number of items later on if our client (whether that’s you or some other party) decides to make changes to the branding. It’ll also help make sure everything is consistent, no more using the eye-dropper to try to make sure everything is the right color (I’m super guilty of doing this from time to time though).
So, let’s just assume, that we’re working with a client that has brand guidelines in place already. We’ve got some colors, some fonts, and some basic treatment principles. Great, all we have to do is mimic this in our Sketch file. Remember from the last post, when we set up those couple pages before designing? Yea, we’re doing that again.
Let’s Make Some Styles
Let’s run through how to create a style again, this time with brand guidelines in mind. Ok, colors first. Why colors first? Well, we have to start somewhere. To get started, let’s create some basic shapes, something like circles or squares. With styles, the shape doesn’t matter in the long run, it’s only the way we treat the object that does. Here we’re going to have a solid style and, potentially, a few outlined styles (thickness of line weight will carry over for styles) for each color in the brand. We should end up with something that looks like this…
To actually create the styles we’ll need to select the object, and click on the ‘No Shared Style’ button on the right-hand side of the Sketch window. Remember, we want to make sure we’re using nice naming conventions, so I’m going to label all my styles along the lines of ‘primaryColor/solid, primaryColor/outlined-2pt, primaryColor/outlined-4pt’ and so on. The use of the ‘/’ is more important in symbols than in styles (we’ll get to that later in this post), but it’s good to use them here as well. When looking at your list of styles, you’ll notice that they aren’t listed in order of creation, but instead, alphabetically. By keeping the primaryColor or secondaryColor in there, we can assure that these styles will be grouped. The /solid or /outlined-2pt is there to differentiate the styles. If you accidentally name the style something you didn’t want to, you can always edit it later.
Styles can also carry over into text, where we can set how we want to handle headers, body copy, link text, sub-headers, whatever we have. Similar to the styles above, we’re going to keep these in our Style Guide page in Sketch. Once again, we have the luxury of working within the client’s brand guidelines, so we don’t have to make up anything on the spot. All we have to do is re-create the guidelines in Sketch. I like to set up my text styles as such…
Once you’ve set the text, it’s time to start applying text styles to these bad boys. This is extremely similar to how we previously set styles, but this time we are working with color, font size, typeface, weight, and line-height, as well as others if you’re adding shadows and such. Now, you’re not limited to just having Header, SubHeader, and Body Text like I do in my example. It’s very likely that your final product will have stuff like ‘imageOverlay’ or ‘profileName’. I’ve had projects that have had upwards of 10 or so different text treatments. Of course the less you have the easier it is on the developers.
So just like we did with the styles, be sure to give the text styles easy-to-decipher names; headerTextBlue or bodyCopyGrey will work better than names like textStyleOne or textStyleLarge.
With that, we should have all our styles ready to go. Fonts are in place, colors are determined; now it’s time to put them to use.
Symbols may be a little bit of a sore spot for early Sketch adapters; there has been problems with using them in the past, but luckily the people at Bohemian Coding are constantly updating them and making them more reliable. Symbols are essentially a special kind of group. They are displayed as a group in the layer list, but with a purple icon instead of a blue one.
Symbols are a good way to make sure when you update one item, all other instances of that item are updated at the same time. Imagine you’ve created an iOS app, and you’re told to change the time in the status bar of all the mockups from 9:41 to 12:51. There’s like 74 screens. Fuck me, right? Wrong. If you’ve made the status bar a symbol, once you update the time on one of them, all others will magically change to match. This will work for ANYTHING that is made into a symbol; status bars, FABs, icons, dividers, you name it. It’s one of the best parts of Sketch, in my opinion.
So let’s make our first symbol. For this example, we’ll just create a Floating Action Button (also known as a FAB) that contains a ‘+’ icon. Nothing too crazy. And, maybe we’ll create the pressed version of it as well (because you always create the normal, active, and pressed states of your buttons right? RIGHT?). But let’s start with the normal state. To get started, we’re going to head over to the Assets page in our sketch document and draw a 60x60-pt circle.
Cool, next, let’s make this guy the secondary color from out client’s brand guidelines (styles are coming into play here!). With the item selected, simply click where you see ‘No Shared Style’ on the right side of your sketch window and change that to the secondaryColor/solid option. Your circle should then take on the properties of that style. Magic, right?
Next, let’s add the icon that we want to use. I’ve created a ‘+’ icon for use here, but you can use whatever. I’m going to create my ‘+’ icon by combining two rectangles with the supportColorGrey/solid style applied to them.
Finally, we’re going to group everything here together. To do so, we need to make sure everything is selected, and then we’re going to Cmd+G. This places everything selected into a folder, allowing it to move around together nicely. From here we can turn this group into a symbol. One of the confusing things about symbols is that they can only be created from groups. Luckily you can create a group of 1 item if needed by simply Cmd+G’ing when you’ve got a single item selected. After we’ve grouped the items, let’s change the name from ‘Group’ to something like ‘fabAdd/normal’.
Last, but not least, let’s create this symbol. To do so, with the group (now named fabAdd/normal) selected, look to the right-hand side of your sketch file where we previously created styles. In it’s place you should see a button with the text ‘No Symbol’. Click on that and select ‘Create New Symbol’. Doing this should auto-populate the name of the symbol with the name of the group currently selected. If not, make sure it is also named fabAdd/normal.
Like we had in shared styles, we’ve got a prefix and subject to our symbol naming. The fabAdd will allow us to group everything of the same prefix in the symbols folder, while the /normal states what the form of that object is. When we create the pressed state of the symbol, we’ll want to call it fabAdd/pressed, active would be something like fabAdd/active, and so on. Each symbol that has different states should be created like so. Doing this will allow our symbol section in Sketch to be extremely well organized and easy to figure out.
Alright, so we’ve got some symbols created, and we’ve eventually added them to our designs, everything looks great. But, the client has come in and requested that all FABs need to be in the primaryColor rather than the secondaryColor we had previously used. Well, that’s easy. All we have to do is Cmd+click on the item in the symbol that is using the secondaryColor/solid style, and change it to primaryColor/solid in the styles menu on the right. As you can see, all instances of that symbol update.
That’s one symbol, but as I previously stated, we want to create the pressed version of the FAB as well. Usually when we tap a button (whether on web or mobile), there is some form of color shift. In this case, i’m going to have the button be a couple shades darker when pressed.
To start, we need to create a new style that is ‘primaryColor/pressed/solid’. Each time we add a / we’re just going a layer deeper. Now, I don’t recommend doing this too much, you don’t want to see a ‘primaryColor/pressed/solid/kinda/slash/overkill’ style because that’s just ridiculous.
Next, we’re going to create a copy of our first FAB on the Assets page. To do so, we just need to option+drag the artboard the /normal state FAB sits on to duplicate it.
Right after you copy the artboard, rename it to what we are eventually going to name the new asset, so fabAdd/pressed. Next, select the copied FAB and click on the button to the right-hand-side of your Sketch file where it indicates the name of the symbol you have selected. You should see and option to Duplicate Symbol. Clicking that should open a text field for you, enter the name of the new symbol when that comes up. This one should be called fabAdd/pressed.
This new symbol now has no affiliation with the original one we created, so editing it should not affect the first one. Let’s assign the primaryColor/pressed/solid style to the circle in this symbol. To do so, once again Cmd+click on the object that uses the style you want to edit, and select the new style from the menu on the right.
And there you go, you now have multiple symbols. If you ever need to insert one the symbols into your design, you can find them in the ‘Insert’ option in your menu bar. You can also see how giving symbols a prefix will help organize them.
Symbols and styles can be a huge time saver in the long run, they just require a little set up in the beginning. But, as with everything in this world, there are some rules and some things to keep in mind.
- Symbols and styles are only relevant to the file they are in. They will not affect another Sketch file, so you’ll have to either copy them into the new file, or re-create them.
- If you edit a style (even accidentally change it’s value), it will affect anything and everything with that style associated.
- If you edit a symbol, it will affect all instances of that symbol.
Have questions? Comments? Corrections? Want to get in contact? Feel free to shoot me a tweet and/or check out the work that my co-workers and I are producing over at Intrepid Pursuits as well as the rest of the teams’ thoughts regarding the mobile world.