You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+60Lines changed: 60 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -625,6 +625,66 @@ An array of four numbers representing the bounding box: `[minX, minY, maxX, maxY
625
625
- "Calculate the bounding box of this GeoJSON file" (then upload a .geojson file)
626
626
- "What's the bounding box for the coordinates in the uploaded parks.geojson file?"
627
627
628
+
#### Color Contrast Checker tool
629
+
630
+
Checks color contrast ratios between foreground and background colors for WCAG 2.1 accessibility compliance.
631
+
632
+
**Parameters:**
633
+
634
+
-`foregroundColor` (string, required): Foreground color (text color) in any CSS format (hex, rgb, rgba, named colors)
635
+
-`backgroundColor` (string, required): Background color in any CSS format (hex, rgb, rgba, named colors)
636
+
-`level` (string, optional): WCAG conformance level to check against ("AA" or "AAA", default: "AA")
637
+
-`fontSize` (string, optional): Font size category ("normal" or "large", default: "normal")
638
+
- Normal: < 18pt or < 14pt bold
639
+
- Large: ≥ 18pt or ≥ 14pt bold
640
+
641
+
**Color format support:**
642
+
643
+
- Hex colors: `#RGB`, `#RRGGBB`, `#RRGGBBAA`
644
+
- RGB/RGBA: `rgb(r, g, b)`, `rgba(r, g, b, a)`
645
+
- Named colors: `black`, `white`, `red`, `blue`, `gray`, etc.
646
+
647
+
**WCAG 2.1 requirements:**
648
+
649
+
- WCAG AA: 4.5:1 for normal text, 3:1 for large text
650
+
- WCAG AAA: 7:1 for normal text, 4.5:1 for large text
651
+
652
+
**Returns:**
653
+
654
+
A JSON object with:
655
+
656
+
-`contrastRatio`: Calculated contrast ratio (e.g., 21 for black on white)
657
+
-`passes`: Whether the combination meets the specified WCAG level
658
+
-`level`: WCAG level checked ("AA" or "AAA")
659
+
-`fontSize`: Font size category ("normal" or "large")
660
+
-`minimumRequired`: Minimum contrast ratio required for the level and font size
661
+
-`wcagRequirements`: Complete WCAG contrast requirements for all levels
662
+
-`recommendations`: Array of suggestions (only included when contrast fails)
663
+
664
+
**Example:**
665
+
666
+
```json
667
+
{
668
+
"contrastRatio": 21,
669
+
"passes": true,
670
+
"level": "AA",
671
+
"fontSize": "normal",
672
+
"minimumRequired": 4.5,
673
+
"wcagRequirements": {
674
+
"AA": { "normal": 4.5, "large": 3.0 },
675
+
"AAA": { "normal": 7.0, "large": 4.5 }
676
+
}
677
+
}
678
+
```
679
+
680
+
**Example prompts:**
681
+
682
+
- "Check if black text on white background is WCAG AA compliant"
683
+
- "What's the contrast ratio between #4264fb and white?"
684
+
- "Does gray text (#767676) on white meet AAA standards for large text?"
685
+
- "Check color contrast for rgb(51, 51, 51) on rgb(245, 245, 245)"
686
+
- "Is this color combination accessible: foreground 'navy' on background 'lightblue'?"
687
+
628
688
#### compare_styles_tool
629
689
630
690
Compares two Mapbox styles and reports structural differences, including changes to layers, sources, and properties. This offline comparison tool performs deep object comparison without requiring API access.
0 commit comments