Development Tools
Built-in tools to help you build accessible, SEO-friendly, and high-quality websites. These tools only appear in development mode and are automatically removed in production builds.
Accessibility Checker
Automatically scans your page for common accessibility issues
What it checks:
- • Missing alt text on images
- • Missing form labels
- • Empty links and buttons
- • Missing ARIA labels
- • Duplicate IDs
- • Heading hierarchy
- • Document language
- • Skip links
Look for the blue accessibility icon in the bottom-left corner
Open Graph Preview
Preview how your page looks when shared on social media
Preview platforms:
- • Facebook / Meta
- • Twitter / X
Shows:
- • Title preview
- • Description preview
- • Image preview
- • Meta tags source
Look for the purple share icon in the bottom-right corner
Color Contrast Checker
Test color combinations for WCAG compliance. Use the contrast utility in your code for automated checks.
WCAG Standards
Understanding contrast ratio requirements
Level AA (Minimum)
- • Normal text: 4.5:1 ratio
- • Large text: 3:1 ratio
Level AAA (Enhanced)
- • Normal text: 7:1 ratio
- • Large text: 4.5:1 ratio
Note: Large text is defined as 18.5px+ (or 14pt+) bold, or 24px+ (or 18pt+) regular.
Contrast Examples
Test different color combinations
Black on White
FG: #000000
BG: #ffffff
White on Black
FG: #ffffff
BG: #000000
White on Blue
FG: #ffffff
BG: #3b82f6
White on Red
FG: #ffffff
BG: #ef4444
Brown on Light Yellow
FG: #92400e
BG: #fef3c7
Gray on Light Gray (Poor)
FG: #6b7280
BG: #f3f4f6
Using Dev Tools
How to integrate these tools into your development workflow
Add to Your Pages
Include dev tools in your Astro layouts
---
// In your layout file (e.g., src/layouts/Layout.astro)
import A11yChecker from '~/components/dev/A11yChecker.astro';
import OGPreview from '~/components/dev/OGPreview.astro';
---
<html>
<head>
<!-- ... -->
</head>
<body>
<!-- Your content -->
<!-- Dev tools (only in development) -->
{import.meta.env.DEV && <A11yChecker />}
{import.meta.env.DEV && <OGPreview />}
</body>
</html> Programmatic Contrast Checking
Use the contrast utility in your code
import { getContrastRatio, getWCAGCompliance } from '~/utils/contrast';
// Check contrast ratio
const ratio = getContrastRatio('#ffffff', '#000000');
console.log(ratio); // 21 (maximum contrast)
// Check WCAG compliance
const compliance = getWCAGCompliance(ratio, 'normal');
console.log(compliance);
// {
// aa: true,
// aaa: true,
// level: 'AAA',
// message: 'Excellent contrast - meets WCAG AAA standards'
// } Production Note
All dev tools automatically detect import.meta.env.DEV and only render in development mode.
They will not appear in your production builds, keeping your site performant and clean.
Try It Out
Test the accessibility checker with intentional issues below