Module color.wcag
Measure WCAG 2 relative luminance and contrast for sRGB.
Use these functions after colors have been reduced to opaque, normalized sRGB or linear-light sRGB. Each result carries validity so out-of-domain input cannot look like an ordinary measurement. Alpha must be resolved first.
Functions
| Name | Description |
|---|---|
wcag2ContrastRatio(first, second)
|
Computes the WCAG 2 contrast ratio between two linear-light sRGB colors. |
wcag2ContrastRatio(first, second)
|
Computes the WCAG 2 contrast ratio between two encoded-sRGB colors. |
wcag2RelativeLuminance(color)
|
Computes WCAG 2 relative luminance from encoded sRGB. |
wcag2RelativeLuminance(color)
|
Computes WCAG 2 relative luminance from linear-light sRGB. |
Structs
| Name | Description |
|---|---|
Wcag2Measurement
|
Holds a WCAG 2 measurement together with its validity state. |