Sub topic 8
Pick a color palette and imagery
This chapter assumes you have a low-fidelity wireframe, know your page sections, and can read basic CSS. Color and imagery are the first visual layers you add to the wireframe. They should support the hierarchy you already ranked, not replace it.
Build a small palette with roles
A homepage palette works best when each color has a job. Start with a few roles and resist adding more.
| Role | Purpose | Example |
|---|---|---|
| Text | Body copy and headings | #1a1a1a |
| Background | Page surface | #ffffff |
| Accent | Primary call to action, links, focus states | #0b5fff |
| Muted | Borders, secondary text, subtle panels | #5c6370 |
| Feedback | Errors and success messages | #b3261e |
The accent color is the most important choice. Use it for the one primary call to action in the hero and for little else. If the accent appears everywhere, the button no longer stands out, and the hierarchy from the previous chapters weakens.
A common approach is the 60-30-10 split. About 60 percent of the page is the background, 30 percent is a secondary or muted color, and 10 percent is the accent.
Check contrast as you choose
Do not wait for the accessibility chapter to test color pairs. Pick each text and background pair, then check its contrast ratio. WCAG 2.x asks for at least 4.5:1 for body text and 3:1 for large text and for interface components such as button borders.
Common problems:
- Light gray text on white, which often falls below 4.5:1.
- White text on a mid-tone accent, which can fail even when it looks fine on your monitor.
- Text placed over a photo with no overlay, where contrast changes from pixel to pixel.
- Using color alone to mark a link or an error. Add an underline or an icon as well.
Choose imagery that does a job
Each image on the homepage should answer a question for the visitor. A hero image shows the product or the outcome. A proof section might use customer photos or logos. Decorative images that answer nothing add load time and noise.
Guidelines:
- Prefer real photos of your product or people over generic stock images.
- Keep one visual style across the page, such as the same lighting, crop, and level of detail.
- Leave quiet space in the image where text will sit, or place the text outside the image.
- Pick focal points that survive cropping, since the image will be cropped differently on mobile and desktop.
- Plan alt text while you choose the image. Informative images need a short description. Purely decorative ones should have empty alt text.
You can also tint photos toward your palette with a consistent overlay. This ties the imagery to the accent and helps text remain readable on top.
Carry the palette into code
The palette becomes the color tokens a developer will receive. Naming them by role, not by hue, lets you change the brand color later without renaming anything.
:root {
--color-text: #1a1a1a;
--color-bg: #ffffff;
--color-muted: #5c6370;
--color-accent: #0b5fff;
}
.button {
background: var(--color-accent);
color: var(--color-bg);
}
.hero img {
width: 100%;
height: auto;
object-fit: cover;
}Here --color-accent is a role name. A name like --blue would become misleading the day the brand changes to green.
Summary of decisions
By the end of this step you should have a short list of role-named colors, each text pair checked for contrast, and a set of images with a clear purpose, a consistent style, and planned alt text. The next step turns these choices into design tokens and reusable components.
Exercise
Your hero button uses white text on a light blue accent, and the contrast ratio is 3.1:1. The button text is regular size. Is this acceptable, and what do you change?
Show answer
It is not acceptable. Regular-size text needs at least 4.5:1. Darken the accent (or use dark text on it) until the pair reaches 4.5:1, then recheck the accent as link text on the page background too.
Exercise
Why name a token --color-accent instead of --color-blue?
Show answer
A role name describes what the color does, so the value can change with a rebrand without making the name wrong or forcing renames across the stylesheet.