Skip to main content

Function: checkThemeContrast()

function checkThemeContrast(resolved): ContrastIssue[];

Defined in: contrast.ts:225

Lints one resolved theme — i.e. one concrete (colour scheme × contrast × density) combination — against the §9 table.

It takes a ResolvedTheme rather than a RasdTheme because mode overlays and aliases must be applied before any ratio means anything; callers that want the full matrix resolve the theme once per mode and concatenate:

for (const colorScheme of ['light', 'dark'] as const)
issues.push(...checkThemeContrast(resolveTheme(theme, { colorScheme })));

Never throws for a colour it cannot parse: an unparseable colour is reported as an error issue, because the linter must survive hostile tenant input.

Parameters

ParameterType
resolvedResolvedTheme

Returns

ContrastIssue[]