Use styles for colors and typography

Styles are a common feature in design tools that help designers use consistent colors and typography. Developers appreciate seeing styles too, because it’s easier to map the styles to variables and existing styles in the codebase or design system.

Colors

For every color used, add it as a style and give it a descriptive name. There are a few techniques for naming colors.

Numerical values

The Material Design color palette uses numbers to signify the saturation of a color.

Purple Colors
Purple 50
Purple 100
Purple 200
Purple 300

Descriptive names

GitHub’s color palette generally follows the numerical logic but also translates the colors into descriptive names.

Descriptive NameNumerical Value
text-gray-lightgray-500
text-graygray-600
text-gray-darkgray-900

✨ Project Check-in:

In the project file, add color styles.


New terms:

  • Color styles: A color or gradient can be defined and reused across your designs.

Resources:


Typography

It’s good practice to name heading styles to match the HTML elements developers will use in production. You do not need to know HTML! This is all you need to know:

HTML NameDescription
H1Heading level 1. The largest and most important text on a page, usually for titles
H2Heading level 2. For subtitles.
H3Heading level 3. For subheaders below an H2.
H4Heading level 4. For subheaders below an H3.
H5Heading level 5. For subheaders below an H4.
H6Heading level 6. For subheaders below an H5.

For other text, you can use a descriptive naming system that explains the styles’ intended use. Remember, there are no hard rules.

NameDescription
Body text or ParagraphBody text
CaptionDescriptive text shown below an image
Modal HeaderA title that appears on a modal (a box that appears with an overlay in the background, requiring the user to interact with it before the underlying page becomes active)
Text Input LabelText that appears next to a text input field
H5Heading level 5. For subheaders below an H4.
H6Heading level 6. For subheaders below an H5.

Note: This is not a comprehensive list.

✨ Project Check-in:

In the project file, add text styles.

✨ Exercise: Styles

Task Summary:
  • Add color styles
  • Add text styles