In the Figmaster - Demo Lessons Figma file, open the Demo Lesson 1 - Neutral colors page.
Introduction
In this chapter, we'll create a neutral color palette for our system. Neutral color is mainly used in large parts of the text interface, and the background, borders, dividing lines, and other scenes are also very common. The neutral color definition needs to consider the difference between the dark background and light background while incorporating the WCAG 2.0 standard. The neutral color for our design system will be based on the transparency of the black color.r
Plugins used in this chapter
Contrast
Chroma Colors
Step 1. Creating test color samples
In this step, we'll create test samples to adjust and quickly set up our color palette.
- Press R on your keyboard to select the Rectangle tool.
- Click inside the Step 1 frame to create the rectangle.
- Change the rectangle's fill color to #000000. Pro tip: You don't need to type '000000' in the hex input. Just type '0' and press Enter and it will automatically set all digits to 0.
- Click on the rectangle, and while pressing ALT + SHIFT move, it 20 px to the right.
- Press CTRL + D to duplicate it, so there are ten rectangles.
- Select all rectangles.
- Press CTRL + R to open Rename modal.
- Rename to: Test sample / $N0 and press Enter. We'll have 10 rectangles named Test sample / 10 to Test sample / 100.
Step 2. Setting up the opacity
Let's set up the opacity for each color rectangle to create the neutral palette. In this step, you'll learn my way of doing this. The opacity values that I provide in this lesson will make the UI accessible, and we will confirm that in the next step. These are the opacity values I normally use. I've found them through experimentation and then tweaked them to be accessible. Don't worry, though. You will be able to set up your values in Step 5 if you need them.
- Select Test sample / 10 and set its color to #FFFFFF. (Psst! Type in 'F' in the hex input and press Enter, remember?)
- Add stroke color #d9d9d9 so you can see it. ('D9' + Enter in the hex input 💪)
- Select the Test sample / 100 rectangle and set its opacity to 96% (Press 9 + 6 on your keyboard).
- Select the Test sample / 90 rectangle and set its opacity to 74%.
- Repeat the process for Test sample / 80 to Test sample / 20 following the rules:
- 80 to 62%
- 70 to 54%
- 60 to 38%
- 50 to 24%
- 40 to 12%
- 30 to 7% (press 0 + 7)
- 20 to 4%
Step 3. Applying the color samples.
Let's apply our test color samples to see how they'll look in the components we'll create in the next module. In the Color test playground, I've prepared some sample components and typography elements. Let's apply our colors to these elements to see how they will look when used.
- Select 'Heading 1', 'Heading 2', and 'Input Label' text elements. Pro tip: click on elements while holding CTRL + SHIFT to keep all items selected.
- Press I to open the color picker tool.
- Pick the color from Test sample / 100 by clicking on the rectangle.
- Select 'Paragraph 1' and 'Paragraph 2' and apply color from Test sample / 90 as you did in the previous steps.
- Repeat the process for the remaining elements like this:
- Test sample / 100 to ‘Option 2 hover’, ‘Option 2 pressed’, Option 2 selected’ texts.
- Test sample / 90 to ‘Option 1, 3 and 4’ texts, ‘Option 2 default’ text, and Tooltip Arrow and Tooltip Content Background. Pro tip: hold CTRL and drag-select text elements with your mouse.
- Test sample / 80 to ‘Input Caption’ text
- Test sample / 70 to ’Input Placeholder’ text
- Test sample / 60 to ‘Option 5 disabled’ all texts
- Test sample / 50 to Dropdown Menu dividers and Input Field stroke
- Test sample / 40 to ‘Option 2 selected’ item background fill
- Test sample / 30 to ‘Option 2 pressed’ item background fill
- Test sample / 20 to ‘Option 2 hover’ item background fill
- Notice: Test sample / 10 is already applied to Input field, Dropdown Menu Backgrounds, and Tooltip text
Step 4. Testing the contrast
You're doing great! OK, now that we have all colors applied, we need to test if they are accessible.
Important! Since Figma allows for only one plugin to be open at a time, the Figmaster plugin will close when you open the Contrast plugin. Don't worry, though. You will find the instructions for this step in Figma too.
- Open the Contrast plugin. (Remember: You can open plugins with Figma's search feature. Press CTRL + / to open the search menu, type 'Contrast', and press Enter. It's faster than looking for the plugin from the right-click menu.)
- Select 'Heading 1' and take a look at the Contrast plugin UI. Check if the AA label in Normal text is green. If it's green, it means that it passed the WC3 standard.
- Having the Contrast plugin open, repeat the action for the rest of the text elements on the playground frame. Pro tip: Did you know that you can select the text elements that are nested inside components without clicking multiple times? Hold CTRL and click on the text element to select it with one click.
Please keep in mind that disabled components are unavailable for interaction, so they don't receive hover or focus and are not subject to WC3 contrast compliance standards. In other words, the text 'Option 5 disabled' does NOT need to pass the Contrast test.
Step 5. Your adjustments (optional step)
Great! We've tested our colors in the UI and checked if they pass the contrast tests. Now you can adjust them for your needs if you want. If you are happy with the result, you can move on to the next step. If not, here's how you can customize the colors for your needs:
- Select the color rectangle on Step 1 frame.
- Change its opacity to match your needs.
- Reapply this color for the items (just like you did in Step 3).
- Open the Contrast plugin.
- Check if the new color passes the contrast test.
- Repeat the action for other colors.
Step 6. Creating color styles.
At this point, we have ten neutral colors. It's time to create color styles so we can use them in the whole project afterward.
Part 1. Creating colors
- Select Neutral / 100 rectangle in Step 5 frame.
- Open the color picker tool (I)
- Pick the color from Test sample / 100 in Step 1 frame.
- Repeat the process for the rest of the colors.
Part 2. Creating styles
Important! Since Figma allows for only one plugin to be open at a time, the Figmaster plugin will close when you open the Chroma Colors plugin. Don't worry, though. You will find the instructions for this step in Figma too.
- Select all rectangles in Step 5 frame. Pro tip: You can select the Step 5 frame and press Enter to select all elements inside.
- Launch Chroma Colors plugin. It will automatically create the color styles.
- In the Styles panel on the right (under Text Styles), new Color Styles appeared under Neutral.
- Unfold the Neutral styles list and move color style 100 to the bottom of the list, so you'll have them listed from 10 to 100.
Great work! Our color styles are almost ready to use!
Step 7. Color styles description
In this step, we'll add descriptions to the color styles. Descriptions display when hovering over the style in the style picker. We'll use a description to communicate how color styles should be used in your designs. Because each color plays its role in the system, it will be great to have it described so you or your teammates don't have to check the documentation each time you want to use the color. It will also make your designs consistent and easier to implement for the developers.
When you select all elements inside the Color test playground frame, you will see ten selection colors appear in the right properties panel. Then, hover over the color and press the 'target' icon to select all elements that use this color. That way, you can determine what colors we use and where.
OK, it's time to describe the styles!
- In the styles panel, right-click on the Neutral / 10 style and select Edit style.
- In the description field, you will see 'FFFFFF'. Delete this text.
- Then type in 'Neutral background, White text' and close this Edit style panel.
- Then edit the next style Neutral / 20.
- In the description field, type 'Item Background Hover, Secondary Background'. Close this panel.
- Repeat the action for the rest of the styles with the following data:
- Neutral / 30 -> 'Item Background Pressed'.
- Neutral / 40 -> 'Item Background Selected'.
- Neutral / 50 -> 'Borders, Dividers'.
- Neutral / 60 -> 'Disabled Text'.
- Neutral / 70 -> 'Placeholder Text'.
- Neutral / 80 -> 'Caption Text, Secondary Text'.
- Neutral / 90 -> 'Body Text, Inactive Text'.
- Neutral / 100 -> 'Headings, Active Text'.
Summary
Awesome work! We've just created a functional and accessible neutral color palette for our design system!