Learn how to create color overrides that all symbols in your pattern library pull from using nested symbols.
- [Instructor] Some things you'll need to do when thinking about color, are stabilizing a primary palette, tints and shade choices, secondary palettes, and solving for accessible contrast. So let's dig into color. Decide your essential brand colors early, and their exact text values because they spread widely and quickly in a design system. So here are some examples of some color. Our primary color, we have our brand color, and our secondary action color here is this kind of purple, and the brand is this kind of teal color.
Discuss adjustments with the brand team, because they're really the brand team's territory. In a lot of cases you may have to make like a brand green, and then a digital green because of accessibility which I'll get to in a second. And then make sure to kind of stack available colors in each hue, and treat the stack as a visualization to include important details compactly. So you'll notice that I've included this tints and shades for the hover and pressed states, then the disabled states here as well so that there's kind of no ambiguity on what their disabled is, what their brand color is, what the hovered and press states are, for each the primary and the secondary colors.
So, offer a handful of options and avoid tedious variety, so empower the system users with enough choice, more than one option, but only up to a few intentional choices, because you don't want to give the users of your system too many options, that would defeat the whole purpose of a pattern library. You'll also notice that we have some colors down here, and they're always really helpful to use here, so define your messaging colors. Here are just a few common ones, the green, yellow, red, and blue.
We have a success screen here, used to signify a save state or success messaging, it may also be used with a check mark icon with input fields to conserve space, and these messagings can occur at the page component or the field level. When you really kind of flush out your design system, make sure that you're including those next to form inputs, which we kind of get into later, and also at the toast level or the error states for a page level error, or success.
Warning yellow is used to message a warning to the customer. Error red is used to message an error to the customer, and the neutral blue is used to notice the customer, it's just kind of an informational message that's not necessarily success, warning, or an error, and then you'll notice that we have some few light grays here, down at the button at the greyscale. These are used to achieve a useful contrast, but just try to limit it, don't get too wishy-washy or wireframey. Consider avoiding a ton of medium grays in between to reduce the number of options you give the users of your design system, and then we have our grayscale down here, and provide a few light grays and a few dark grays to achieve useful contrast, but don't get too wishy-washy or wireframey, and I consider avoiding a ton of medium grays in the middle, and that's so that you can reduce the number of options you give your users in the design system.
So I want to also touch on contrast and accessibility, so accessibility in the web world is making products and services that everyone can enjoy regardless of their abilities. This is creating flexible systems that consider the experiences of people with disabilities from the start, and that means maintaining reasonable contrast ratios between text and background colors, and the ratio is 4:5:1 for small text, and 3:1 for large text, and I don't expect you to be able to just off hand do that, so there are a lot of online tools that you can use to check your accessibility.
That is, whatever the text color on the background color. So this is just as an example, this white over this blue, it has to be a particular contrast so that the user is able to read it. So let's just quickly go into one of my recent favorite tools here, is Hex Naw. It's kind of cool, kind of funny, a little bit, and it's pretty easy to use. Let's take our brand color, just to enter our hex values, just to show you how to test this accessibility. This has a hex value of 177E89, and then the second color we're going to test is white on top of that, so FFFFFF, and that's the hex color as white, and I'm doing the white over top of this is because that is what our buttons are going to be.
So we're going to have white text over our brand color. So I just want to test that color and this is kind of what comes up. So you'll notice that it works, the contrast ratio is 4.7.9, and this works for large text and for small text. This tool is really useful when you are choosing colors and making sure that they are accessible from the start, because that is going to be a really big piece of your design system color, so trying to make sure that you get that right first is really important.
So let's go back to our Sketch document, and I want to show you how to set up color in your document. So I already created symbols for color for some of these, you'll notice that here on the side with the arrows here, this is actually a symbol, and it is pulling just a color swatch of brand. I want to show you kind of how to do that, and one of these that I didn't actually set up was this gray here, gray 94.
So what I'm going to do here is click into the swatch, and I'm going to select the swatch, I'm not actually going to select the text on top of that, 'cause we really only want the actual color as a symbol, so that we can use it in other instances throughout our Sketch file. So I have this rectangle selected and I'm going to go to the top and hit create symbol, and naming these symbols is really important. This naming sets up how your override panels work. So the backslashes are basically the nesting piece.
So I'm going to name it color, grayscale, 94, so that's what we call this, and I'm going to hit okay. So when we go to our symbols page, you'll notice that I have this color, grayscale, 94, over here, and just for organization sake and because I have all of my nice colors over here I'm going to move it over here. So you might not have to do this and move this over here, and create all of these organize, and I'm going to kind of adjust this size because in my actual design, I have them as these long pieces, but I want to kind of shorten them in my symbols page, and make them all one size.
What I'm going to do is I'm going to check this and I'm going to just resize it to the other size. So 96 by 96, just so that it fits all with the other ones here, and then all you have to do is do that with all of your color symbols. Just make sure to name them properly so that your overrides will be organized. So I name them like this, so I have color, brand, primary, and then I have color, brand, secondary, and then my messaging colors are color, messaging, warning yellow, color, messaging, success green, color, messaging, neutral blue, color, messaging, error red, and then the grayscales here, color, grayscale, white, grayscale 80, 30, 10, think you kind of get the picture here.
So when I talked about that naming, how important it is, if you go up here to the top at insert, and you go to symbols, you'll see here that you have your brand, primary, secondary, we have our grayscales, and our messaging. Error red, neutral blue, success green, warning yellow. So also notice that I kind of messed up here, which is good to show, it is case sensitive. So in order for me to get that grayscale back into this grayscale, I have to actually name it the grayscale.
So you'll notice here that this is capital grayscale, and I did lowercase grayscale. So let's go ahead and go back and make that capital grayscale. So that we can see now that it's within this grayscale piece. I also wanted to show you how to create document colors as well. So if you click on one of these swatches you'll notice you get this fill here, so here you'll notice that you have your global colors and your document colors. Now I'm not going to really use these global colors here so I have collapsed them, so you can just collapse them there.
So you have your document colors. I've already added all of my document colors here, but I want to show you how to add some of them, I'm going to add the messaging colors for you here to see. So if I want to add my success green, all you have to do is select that swatch and hit the plus button. So I'm going to do it with this yellow. Select that swatch and click the plus button. One more with the red, and then with the blue, and then just because I'm organized I want to just kind of rearrange them, all you do is click and drag, and to get them nice and organized within all of your colors here, and document colors save time when you know what your brand colors are and what you're designing.
They can also limit you to using only a certain number of colors, and that's really good when you're trying to design a pattern library. If you limit your users to only being able to use a certain number of colors, that will achieve the consistency that you're looking for with a design system. Now that we have our colors set up as symbols and at a document level with everything we create we have a specific subset of colors to work from, and an understanding of how, why, and when they're used.