fix(a11y): WCAG AA colour contrast across every route (P0.1)
Live axe-core inventory found 13 failing fg/bg pairs (3.12:1 coral text/ fills, 4.0-4.5 teal near-misses, 2.7 gold badge, 1.9 chart-colour text). All replacement values validated ≥4.5:1 against every background they sit on: - --accent-coral-dark deepened to #b04a2e and used for coral text roles (nav active, back/map links, kickers, chips) and coral fills under white text (btn-primary, phase tabs, section-nav compare, chart chips); new --accent-coral-darker #9c3f26 for their hovers. Decorative coral (pins, bars, borders, focus ring) keeps the brand #e07256. - --accent-teal darkened to #296f6f (rankings values, metric rows, ofsted grades, eyebrows all pass). - Ofsted green #3c8c3c→#2f7a2f; off-token gold #b8920e→--accent-gold-text. - Gender-split pink text #b45778→#a04a68; admissions tip numerals to a 3.8:1 muted brown (28px display text). - New CHART_TEXT_COLORS: AA-dark counterparts of the Chart.js series palette for compare-card values (swatch dots keep true series colour). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -275,6 +275,27 @@ export function getChartColor(index: number): string {
|
||||
return CHART_COLORS[index % CHART_COLORS.length];
|
||||
}
|
||||
|
||||
/**
|
||||
* Darker counterparts of CHART_COLORS for use as TEXT on the site's light
|
||||
* backgrounds — the raw series colours fail WCAG AA (e.g. 1.9:1 on cream).
|
||||
* Same hue per index so text still keys to its chart line. All ≥4.5:1 on
|
||||
* #f3ede4 and lighter.
|
||||
*/
|
||||
export const CHART_TEXT_COLORS = [
|
||||
'#256868', // teal
|
||||
'#c2255c', // pink/red
|
||||
'#2069ad', // blue
|
||||
'#8a5a00', // yellow → ochre
|
||||
'#6d43c8', // purple
|
||||
'#8f4e00', // orange → brown
|
||||
'#5f5952', // grey
|
||||
'#a300a3', // magenta
|
||||
];
|
||||
|
||||
export function getChartTextColor(index: number): string {
|
||||
return CHART_TEXT_COLORS[index % CHART_TEXT_COLORS.length];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert RGB color to RGBA with opacity
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user