Please enable JavaScript to use CodeHS

Web Design — Visual Design

Color and mood

Color is one of the first things people notice about a website. The right palette sets the mood, guides attention, and makes content easier to read. Learn how to choose colors that match what you want your site to feel like.

Color Theory ~10 min Middle / High School
The Big Idea

Why color matters

Before anyone reads a word on your site, they see color. Color can make a page feel playful, serious, calm, or urgent. It also helps users understand what is important: buttons, links, headings, and warnings all stand out because of color choices.

Good web design does not mean using every color. It means choosing a small set of colors and using them consistently. Most professional sites use one or two main colors, a neutral color, and an accent color for calls to action.


Vocabulary

Hue, saturation, lightness

Colors can be described in many ways. One helpful model is HSL:

  • Hue is the color family: red, orange, blue, and so on. It is measured in degrees around a color wheel.
  • Saturation is how intense or grayed-out the color is. High saturation looks vivid; low saturation looks muted.
  • Lightness is how close the color is to white or black. Higher lightness means a lighter color.

By adjusting these three values, you can create many variations of the same base color without needing to memorize hex codes.


Design Skill

Creating a palette

A simple palette usually has three parts:

  • Primary: the main color of your brand or site.
  • Neutrals: black, white, grays, or soft browns for text and backgrounds.
  • Accent: a bright color for buttons, links, and important highlights.

Colors that look good together are called harmonious. Common harmonies are complementary (opposite on the color wheel), analogous (next to each other), and monochromatic (different shades of one hue).


Critical Thinking

Color and mood

Colors carry cultural meaning, but context matters. Red can mean danger, love, or excitement depending on where it appears. Blue often feels calm and trustworthy, which is why banks and social networks use it. Yellow is energetic but can be hard to read as text.

When choosing colors, ask: who is your audience, and what do you want them to feel? A gaming site might use bold, saturated colors. A medical site might use clean blues and whites. A bakery might use warm oranges and browns.

Tip: start with one color you like, then build a palette around it. Test your palette on both light and dark backgrounds to make sure text stays readable.


Interactive

Palette explorer

Use the sliders to create a base color. The demo then shows a complementary swatch and lighter/darker variations. Notice how changing saturation and lightness affects the mood.

hsl(210, 70%, 50%)

Palette


Code

A color palette in CSS

Colors set the mood of a site. This CSS defines a simple palette using custom properties so you can reuse the same colors everywhere.


Your Turn

Check yourself

Think of a website you like. What are its main colors, and what mood do they create? Would the site feel different with a different palette?

Your answer:

Sample answer: A news site might use dark blue and white to feel serious and trustworthy. If it switched to neon pink and green, it would feel more playful but less credible.


Check Yourself

Quick quiz

1. In HSL, what does saturation control?

2. Which color is typically associated with calm and trust?

3. What is a simple, effective palette structure?

Keep learning

You can build a color palette. Next, learn how typography shapes the personality of a page.

First tutorial in the Web Design: Visual Design series.