Sketch Tutorials
How to Reclaim 87 Hours of Your Life with
Create hundreds of text and layer styles automagically in minutes
When Sketch 52 came out, they introduced the ability to override symbols using text styles and layer styles instead of having to create those awful color/text symbols. Remember those? Ew.
While this was a massive win for folks like me who were already super fussy about creating and maintaining text styles, the complaining had already begun on and Twitter about the need to create text styles.
I, for one, welcome the change with open arms and a basket of baked goods, but I understand that it’s a bit of a tedious task to create text styles.
Fear not, designer dudes and dudettes, I’ve come for your deliverance.
In this tutorial, I’ll show you how I automate creating hundreds of text and layers styles so I can use them when I create my symbols in .
Requirements
- Rename It Plugin by
- Find & Replace Plugin by
- Sketch Styles Generator by
- Patience!
What we’re making
There are 972 named text styles in the grid below. We’re gonna make those. 😀
Step 1
Set up your base typography sizes. After doing this same thing for three years, I’ve found that I never need more than nine sizes (and I rarely use the largest ones).
Step 2
Name your layers. This is vitally important because our Styles Generator plugin will use the layer names to generate styles.
In order to take advantage of Sketch’s “foldering” system for saved styles, I like to use the following naming hierarchy:
00 SIZE/COLOR/TRANSPARENCY — ALIGNMENT
- 00: This will keep my text styles in order of increasing size in the saved styles menu (see below).
- SIZE: This is the name of my text style. Unless you want them to, they’re not intended to map to actual HTML tags. I find it’s much easier to remember text styles and their relative sizes if they have names (instead of H1, H2, H3, etc.).
- COLOR: This is the color of the text style. Except for Black and White, I recommend using generic names for your colors (Primary, Secondary, Accent 1, Accent 2, etc.) because you might end up changing that color down the road. It’d suck to be stuck with 104 “red” styles when the color has changed to blue.
- TRANSPARENCY: I’ve talked about this before, so go check out #3 in this article for more information. Basically this is the lightness level of this particular color.
- ALIGNMENT: Left, Center, Right. This is how your text is aligned.
Once you have your five to ten base text layers named according to the structure above, you’re ready to move to Step 3.
Step 3
Highlight all of your text layers and duplicate them. While the new duplicates are still selected, run your Find & Replace plugin and replace the alignment:
Don’t forget to actually change the alignment of these layers. I tend to forget that step.
Rinse and repeat for all alignments (Left, Center, Right).
Step 4
Now we’re going to do the same duplicate/find/replace action on transparency. I like to create three levels: Default, Light, and Lighter.
I use these names intentionally because Sketch alphabetizes your layer styles. Feel free to come up with your own names, but I recommend keeping them in transparency order in that styles menu, so name them accordingly:
Again, don’t forget to actually change the transparency on the duplicated layers. I usually do 100%, 50%, and 25%.
Rinse and repeat for all opacity levels (Default, Light, Lighter).
Step 5
Awesome. You just created what I’m calling a “master set” of text styles with three alignments and three opacity levels. That’s a lot of text styles!
Now we’re going to use this master set to quickly create master sets for a bunch of different colors!
Duplicate the master sets that you just created for as many colors as you need. Use the Find & Replace plugin to change the color name, and change the color:
Step 6
Once you’ve done this for all of the colors you want, you’re ready to run the Styles Generator plugin!
Highlight all of the text layers you just created, then choose “Generate Shared Styles” to create styles! If you’ve installed the plugin correctly, you’ll find it in Plugins → Styles Generator → Generate Shared Styles.
Warning: It might take a minute or two… you’re generating several hundred text styles all at once, so give it time to do its thing. Go get a cup of coffee or bug your coworkers.
When you’re done, you should have a beautiful list of saved styles, all ready for you to start using in your designs and symbols:
Step 7
At this point you’re finished, but I want to add that you’ve actually just created a beautiful style guide that will allow you to make bulk changes to your saved text styles super easily.
Just click and drag to highlight all of the text layers in one of the color rows, change the color using the color picker in the Inspector panel, then update the styles in the Appearance dropdown:
Sketch is smart enough to preserve all of the individual attributes of each unique text style, so when you update the color, it’ll leave the alignment and transparency alone. I love you, Sketch.
That’s it!
You just generated several hundred text styles in about five minutes. You can use this same method for generating layer styles for things like colors and borders:
Because I love you all, I’m going to give you one of my text style sheets. This file has 972 text styles in all kinds of different colors, alignments, and transparency levels. You’re welcome!