---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/tools/color/variables/colorContrastTool.md
description: Compute the WCAG 2.1 contrast ratio between two colours.
---

# Variable: colorContrastTool

```ts
const colorContrastTool: Tool<SpooledArtifact>;
```

Defined in: [batteries/tools/color/index.ts:457](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/batteries/tools/color/index.ts#L457)

Compute the WCAG 2.1 contrast ratio between two colours.

## Remarks

Accepts hex (`#rgb`, `#rrggbb`), `rgb()`, `hsl()`, or one of the CSS / Material Design named
colours. Reports the ratio and pass/fail against WCAG AA and AAA at both normal and large text
sizes. If the foreground/background combination fails AA Normal (4.5:1), the tool suggests
lightened or darkened variants that would pass.
