Function: parseQrCodeRenderOptions()
function parseQrCodeRenderOptions(options: {
backgroundColor?: string;
description?: string;
minContrastRatio?: number;
moduleColor?: string;
size?: number;
title: string;
}): Required<Omit<{
backgroundColor?: string;
description?: string;
minContrastRatio?: number;
moduleColor?: string;
size?: number;
title: string;
}, "description">> & Pick<{
backgroundColor?: string;
description?: string;
minContrastRatio?: number;
moduleColor?: string;
size?: number;
title: string;
}, "description">;Defined in: shared/qr-code/svg.ts:129
Validate and normalize render options, applying every invariant both
rendering surfaces owe their callers: schema validation (non-empty title,
size in range, contrast floor) plus the paint assertions.
Exists because there are two surfaces over one encoder — this string renderer
and the UDS QRCode component, which takes props directly and cannot parse a
schema on its own. Both call this, so neither can drift on a guarantee. Adding
a rule here covers both; adding one to the schema alone would not.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | { backgroundColor?: string; description?: string; minContrastRatio?: number; moduleColor?: string; size?: number; title: string; } | - |
options.backgroundColor? | string | Paint for the light modules and quiet zone. Same constraints as moduleColor. |
options.description? | string | Longer text alternative, rendered as <desc>. |
options.minContrastRatio? | number | Contrast floor enforced between moduleColor and backgroundColor. Can only be raised, not lowered — QR_CODE_MIN_CONTRAST_RATIO is both the default and the floor, since a symbol below it is unreliable to scan regardless of what the caller would prefer. |
options.moduleColor? | string | Paint for the dark modules. Must be a statically resolvable, fully opaque CSS color — a hex or rgb() literal, black, or white. Design tokens (var(--x)) and currentColor are rejected: their contrast can't be verified, and an unverifiable symbol can't be guaranteed to scan. |
options.size? | number | Rendered width and height in CSS pixels. The SVG scales losslessly. |
options.title | string | Accessible name for the image, rendered as <title>. Required: a QR code is a meaningful image, so Section 508 / WCAG 1.1.1 needs a text alternative. Describe the purpose ("Appointment check-in code"), not the payload. |
Returns
Required<Omit<{
backgroundColor?: string;
description?: string;
minContrastRatio?: number;
moduleColor?: string;
size?: number;
title: string;
}, "description">> & Pick<{
backgroundColor?: string;
description?: string;
minContrastRatio?: number;
moduleColor?: string;
size?: number;
title: string;
}, "description">