Smallest overlay for legible text on an image
colors_scrimFinds the smallest overlay opacity that makes text reach a target contrast ratio on every worst-case region of a photo, returning the opacity and per-region ratios.
Instructions
Text over a photo: find the smallest overlay (scrim) opacity at which the text reaches a contrast ratio on every worst-case region of the image. Painted like CSS, on 8-bit channels. Returns the opacity and the ratio on each region.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"text": "<text>",
"overlay": "<overlay>",
"regions": "<regions>"
},
"name": "colors_scrim"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| step | No | Opacity grid, for example 0.05. Default 0.05. | |
| text | Yes | Text color that sits on the image. Any CSS color: "#3b82f6", "rgb(59 130 246)", "oklch(0.62 0.19 260)", "tomato". | |
| target | No | Contrast ratio the text must reach on every region. Default 4.5. | |
| overlay | Yes | Overlay (scrim) color, usually black, white or a brand color. Any CSS color: "#3b82f6", "rgb(59 130 246)", "oklch(0.62 0.19 260)", "tomato". | |
| regions | Yes | Colors of the busiest or worst-case parts of the image behind the text. A list, even for a single color. Any CSS color strings. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| found | Yes | ||
| ratios | No | ||
| opacity | No |