v-contrast

Directive

Automatically adjusts foreground text colour to meet the WCAG AA contrast ratio (4.5:1 by default, configurable via createOrigam). Pass false to opt out on a specific element.

API

Valeur / Arguments

Forme de la valeur du binding et de chaque propriété de l'objet d'options.

value
boolean | undefined
Omit or set to true to enable auto-contrast. Pass false to disable contrast enforcement for this element only.

The threshold and algorithm are set globally in createOrigam({ contrast: { threshold: 4.5 } }). Individual elements can override with v-contrast="false" but cannot raise the threshold above the global value.

Usage

Exemples

Extraits de code prêts à coller dans vos templates.

Auto-contrast on a coloured surface

vue

Per-element opt-out

vue