Learning intentions
- I can create a colour palette for my portfolio.
- I can verify my colours meet WCAG AA contrast (4.5:1 for body text).
- I can use hex, rgb, and hsl colour values in CSS.
Success criteria
- I have a documented palette of 3-5 colours with hex codes.
- Every text/background pair passes WCAG AA (4.5:1 contrast).
- I have tested my palette in WebAIM Contrast Checker.
Do Now · 5 min
Look at these pairs and predict which ones you can read outside in sunlight:
- Black text on white background
- Grey (#888) text on white background
- Light yellow text on white background
- Dark blue text on light blue background
Only #1 and #4 have a chance. WCAG measures this with a contrast ratio. Today we learn the rules.
I Do · ~10 min Teacher demonstration
Teacher explains WCAG (Web Content Accessibility Guidelines):
- Body text: at least 4.5:1 contrast ratio
- Large text (18pt+): at least 3:1
- UI components (buttons, form fields): at least 3:1
Teacher opens WebAIM Contrast Checker and tests:
Foreground: #333333
Background: #ffffff
Ratio: 12.63:1 ✓ AAA
Foreground: #888888
Background: #ffffff
Ratio: 3.54:1 ✗ Fails AA for body text
Colour systems in CSS:
color: #1f3a68; /* hex - most common */
color: rgb(31, 58, 104); /* red, green, blue 0-255 */
color: hsl(220, 54%, 26%); /* hue, saturation, lightness */
The POUR framework — WCAG's core principles in 4 letters
WCAG 2.2 organises accessibility around 4 principles. Remember them as POUR:
- Perceivable — content must be visible/audible to all senses (alt text for images, captions for video)
- Operable — the interface must be usable (keyboard navigation, enough time to interact)
- Understandable — text and operation must make sense (clear language, predictable patterns)
- Robust — content must work with current + future assistive technologies (valid HTML, semantic tags)
Contrast (4.5:1) is one specific rule under "Perceivable". But accessibility is more than contrast.
We Do · ~15 min Guided build
Together, build a palette in Coolors:
- Press Space to generate random palette
- Lock the colours you like, regenerate until you're happy
- Copy hex codes
- Test each text/background combination in WebAIM Contrast Checker
Class discussion: which palette works for a calm, professional portfolio? Which works for a loud, creative one?
You Do · ~35 min Independent practice
Design your portfolio palette. Create a spec sheet (in HTML or a doc):
- Pick 3-5 colours: one primary, one accent, one text, one background, optional support
- Record hex codes
- Test every text/background combination in WebAIM Contrast Checker
- Record the contrast ratio for each
- Flag any failing combinations — choose replacements
Apply your palette to your portfolio styles.css (update from L11's work).
Differentiation
Support
3 curated accessible palettes provided. Pick one and document the contrast ratios.
Core
Build your own palette from scratch.
Extension
Add a dark mode palette — same hierarchy, inverted lightness — and use prefers-color-scheme media query.
Exit Ticket · 5 min
Exit ticket
1. What is the WCAG AA contrast ratio for body text? _______ : 1
2. Your palette:
Primary: #________ Contrast with BG: _____:1
Background: #________
Text: #________ Contrast with BG: _____:1
Accent: #________ Contrast with BG: _____:1
Resources for this lesson
📚 Deeper Reading
External references drawn from Shay Howe's "Learn to Code HTML & CSS" and University of Michigan's "Web Design for Everybody" Coursera specialization. All credit to original authors.
- Shay Howe · Ch 7: Setting Backgrounds & Gradients
background-color, -image, gradients. Extension content beyond Year 10 but useful. - UMich HTML5 · M3 L1: Accessible Web + POUR
POUR framework (Perceivable, Operable, Understandable, Robust) — the WCAG mnemonic. - WebAIM Contrast Checker
Industry-standard contrast verification tool.