Skip to content
Tutorials Center
My learning

Topics

Lesson 14 of 36 ยท Shapes, Text and Styles

Color, Contrast and Color Styles in Figma

Choose and organize color in Figma: color models, palettes, color styles, accessibility contrast ratios (WCAG) and dark mode basics, with a runnable contrast checker.

Color is the fastest way to make an interface feel polished or messy. A good palette is small, named, and accessible: people with low vision or in bright sunlight must still read your text. In this lesson you will pick colors with confidence, save them as color styles, and check contrast ratios with the same formula that accessibility guidelines use.

Color models in Figma

When you click a fill swatch, the color picker offers several ways to enter a color:

  • Hex: 4F46E5, the most common format for handoff.
  • RGB: red, green and blue, each 0 to 255.
  • HSL / HSB: hue (0 to 360), saturation and lightness or brightness. These are easier to reason about than RGB: to make a color lighter, raise its lightness.
  • CSS: copy rgb(79 70 229) style values.

The picker also has an eyedropper (press I) to sample any color on screen, and the Libraries tab for styles and variables from team libraries.

Python Stand-in: hex, RGB and HSL

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Building a palette

A practical palette for a product has:

  • A brand/primary color with a light-to-dark ramp (50, 100, 200 ... 900).
  • A neutral ramp (greys) for text, borders and backgrounds.
  • Semantic colors: success (green), warning (amber), danger (red), info (blue).

Generate ramps by changing lightness while keeping hue similar, and adjust by eye because pure math makes some steps feel uneven. A 10-step ramp gives you enough tints for backgrounds, borders, hover states and text.

A product palette

Primary Brand color ramp
Neutral Text, borders, backgrounds
Semantic Success, warning, danger

Fewer colors, used consistently

1 / 2

Color styles

A color style names a fill (or stroke) so you can reuse it. To create one: select a layer with the color, click the four-dots Style icon beside Fill, press the plus, and name it, for example Primary/600. Use slashes to group: Neutral/900, Success/500. Then:

  • Apply the style to other layers from the picker.
  • Edit the style to change the color everywhere it is used.
  • Styles show up in the Assets tab and in Dev Mode with their names.

Figma also has variables for colors, which can switch by mode (light and dark) and are the modern foundation of design systems. We cover them in the design systems chapter; styles remain a simple, widely used way to start.

Name styles by purpose, not appearance: Text/Primary outlives a rebrand while Dark grey does not.

Contrast and accessibility

The Web Content Accessibility Guidelines (WCAG) define contrast ratio between two colors, from 1:1 (identical) to 21:1 (black on white). Minimums:

Level Normal text Large text (about 24 px, or 19 px bold) UI components
AA 4.5 : 1 3 : 1 3 : 1
AAA 7 : 1 4.5 : 1 n/a

The ratio uses relative luminance, a measure of how bright a color appears:

  1. Convert each channel from 0-255 to 0-1.
  2. Linearize it: if c is at most 0.03928 use c / 12.92, otherwise ((c + 0.055) / 1.055) ^ 2.4.
  3. L = 0.2126 R + 0.7152 G + 0.0722 B.
  4. Contrast = (L_lighter + 0.05) / (L_darker + 0.05).

A contrast checker stand-in

The stand-in below implements those steps. It is not a Figma plugin; plugins such as contrast checkers exist in Figma's Community, and you can compare their numbers with this code.

Python Stand-in: WCAG contrast ratio

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Black on white gives exactly 21:1. Notice how a mid grey such as #94A3B8 fails for normal text; it is a common mistake for placeholder and caption text.

Fixing a failing color

Instead of guessing, darken the color step by step until it passes. The stand-in below finds the lightest shade of a grey that still meets 4.5:1 on white.

Python Stand-in: darken until it passes AA

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The lightest neutral grey that passes AA on white is #767676, a number designers remember because it appears so often.

Dark mode basics

Do not simply invert colors. Dark interfaces use dark grey (not pure black) backgrounds, slightly desaturated brand colors and lighter text, and they express elevation with lighter surfaces rather than shadows. Plan for modes early by giving colors semantic names (Surface, Text/Primary), which makes switching to variables painless.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the minimum AA contrast ratio for normal body text?

    WCAG AA requires 4.5:1 for normal text and 3:1 for large text.
  2. 2. Which color style name will survive a rebrand best?

    Purpose-based names describe a role, not a hue.
  3. 3. What is the maximum possible contrast ratio?

    Black on white is 21:1.
  4. 4. Which is better for dark mode backgrounds?

    Pure black can look harsh; dark greys express depth.

Summary

  • Enter colors as hex, RGB or HSL; ramps built by lightness give you tints and shades.
  • Color styles name colors by purpose; editing a style updates every layer.
  • WCAG AA needs 4.5:1 for text and 3:1 for large text and UI elements.
  • Semantic names prepare you for variables and dark mode.

Next: Auto Layout Basics