Sub topic 2
Picking an Accent Colour
Prerequisites: you should know basic HTML and CSS, understand hex or RGB colour values, and be able to edit a stylesheet and view it in a browser.
Picking an Accent Colour
An accent colour draws attention to a small set of important elements, such as calls to action, badges, or highlights. Choose it by comparing its hue with the primary colour on the colour wheel.
A complementary hue sits opposite the primary hue and creates strong contrast. An analogous hue sits nearby and creates a quieter result. Use a complementary accent sparingly because it can overpower the interface.
:root {
--primary-500: hsl(220 80% 50%);
--accent-500: hsl(35 95% 50%); /* warm contrast to blue */
}The accent should have a clear job. Do not use it for ordinary body text, borders, and every button.
Balancing Colours with 60-30-10
The 60-30-10 guideline is a starting point for visual proportion:
| Share | Role | Typical use |
|---|---|---|
| 60% | Neutral | Page backgrounds and large surfaces |
| 30% | Primary or supporting neutral | Panels, navigation, and major regions |
| 10% | Accent | Actions, status emphasis, and selected states |
Treat these values as area, not as a required count of elements. A page with many small accent controls may still use only a small visual area.
Expanding Colours into Scales
A scale contains several shades and tints of one hue. In HSL, keep the hue stable and change lightness. Dark steps suit text and controls. Light steps suit backgrounds and focus states.
:root {
--accent-100: hsl(35 95% 92%);
--accent-500: hsl(35 95% 50%);
--accent-700: hsl(35 95% 34%);
--color-highlight-bg: var(--accent-100);
--color-highlight-text: var(--accent-700);
}Check each step against the surface where it will appear. A scale that looks orderly can still produce unreadable text.
Checking Contrast Against WCAG
Contrast ratio compares the relative luminance of two colours. WCAG recommends at least 4.5:1 for normal text and 3:1 for large text. User-interface components and graphical objects generally need at least 3:1 against adjacent colours.
Test combinations such as accent text on a neutral background, not just the accent swatch by itself. Also check links, focus indicators, disabled-looking controls, and selected states. Colour should not be the only sign of meaning; add text, shape, or an icon where needed.
Exercise
Your primary colour is blue at hue 220°. You need a high-attention accent. Which hue relationship should you try first, and what must you test afterward?
Show answer
Try a complementary warm hue near 40°. Test its contrast against every intended surface and limit its use so it does not dominate the page.