feat: implement accessibility tools and named colors explorer
Add comprehensive accessibility features and color naming:
**Color Utilities (lib/utils/color.ts):**
- getRelativeLuminance() - WCAG 2.1 luminance calculation
- getContrastRatio() - Contrast ratio between two colors
- hexToRgb() - Convert hex to RGB
- checkWCAGCompliance() - AA/AAA compliance checker
- Full WCAG 2.1 specification implementation
**New UI Component:**
- Badge component - Status indicators
- Variants: default, success, warning, destructive, outline
- Used for pass/fail indicators
- Accessible focus states
**Accessibility Pages:**
1. Contrast Checker (/accessibility/contrast)
- Dual color pickers (foreground/background)
- Real-time contrast ratio calculation
- Live text preview with both colors
- WCAG 2.1 compliance display:
- Level AA: Normal text (4.5:1), Large text (3:1), UI (3:1)
- Level AAA: Normal text (7:1), Large text (4.5:1)
- Pass/Fail badges for each criterion
- Swap colors button
- Visual feedback with color-coded results
2. Accessibility Dashboard (/accessibility)
- Overview of all accessibility tools
- Feature cards with icons
- Educational content about WCAG 2.1
- Standards explanation (AA vs AAA)
- Links to each tool
**Named Colors Page (/names):**
- Display all 148 CSS/X11 named colors
- Search by name or hex value
- Sort options (name, hue)
- Responsive grid layout (2-6 columns)
- Click to copy color
- Color name and hex display
- Loading and error states
- Empty state for no results
- Real-time filtering
**Batch Operations Page (/batch):**
- Placeholder "Coming Soon" page
- Feature preview list
- Planned capabilities description
- Professional coming soon message
**Features Implemented:**
- Real WCAG calculations (not approximations)
- Live contrast ratio updates
- Interactive color swapping
- Comprehensive compliance checking
- Educational content
- Named colors from API
- Search and filtering
- Responsive layouts
**Build Status:**
✅ 11 pages successfully rendering
✅ All TypeScript checks passing
✅ No build errors
All major sections now have functional or placeholder pages!
Next: Polish, testing, and additional enhancements.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 11:42:55 +01:00
|
|
|
import Link from 'next/link';
|
|
|
|
|
import { Contrast, Eye, Palette } from 'lucide-react';
|
|
|
|
|
|
|
|
|
|
export default function AccessibilityPage() {
|
|
|
|
|
const tools = [
|
|
|
|
|
{
|
|
|
|
|
title: 'Contrast Checker',
|
|
|
|
|
description: 'Test color combinations for WCAG 2.1 AA and AAA compliance',
|
|
|
|
|
href: '/accessibility/contrast',
|
|
|
|
|
icon: Contrast,
|
|
|
|
|
features: ['WCAG 2.1 standards', 'AA/AAA ratings', 'Live preview'],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Color Blindness Simulator',
|
|
|
|
|
description: 'Simulate how colors appear with different types of color blindness',
|
|
|
|
|
href: '/accessibility/colorblind',
|
|
|
|
|
icon: Eye,
|
|
|
|
|
features: ['Protanopia', 'Deuteranopia', 'Tritanopia'],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: 'Text Color Optimizer',
|
|
|
|
|
description: 'Find the best text color for any background automatically',
|
|
|
|
|
href: '/accessibility/textcolor',
|
|
|
|
|
icon: Palette,
|
|
|
|
|
features: ['Automatic optimization', 'WCAG guaranteed', 'Light/dark options'],
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return (
|
2025-11-07 16:20:59 +01:00
|
|
|
<div className="min-h-screen px-8 py-12">
|
feat: implement accessibility tools and named colors explorer
Add comprehensive accessibility features and color naming:
**Color Utilities (lib/utils/color.ts):**
- getRelativeLuminance() - WCAG 2.1 luminance calculation
- getContrastRatio() - Contrast ratio between two colors
- hexToRgb() - Convert hex to RGB
- checkWCAGCompliance() - AA/AAA compliance checker
- Full WCAG 2.1 specification implementation
**New UI Component:**
- Badge component - Status indicators
- Variants: default, success, warning, destructive, outline
- Used for pass/fail indicators
- Accessible focus states
**Accessibility Pages:**
1. Contrast Checker (/accessibility/contrast)
- Dual color pickers (foreground/background)
- Real-time contrast ratio calculation
- Live text preview with both colors
- WCAG 2.1 compliance display:
- Level AA: Normal text (4.5:1), Large text (3:1), UI (3:1)
- Level AAA: Normal text (7:1), Large text (4.5:1)
- Pass/Fail badges for each criterion
- Swap colors button
- Visual feedback with color-coded results
2. Accessibility Dashboard (/accessibility)
- Overview of all accessibility tools
- Feature cards with icons
- Educational content about WCAG 2.1
- Standards explanation (AA vs AAA)
- Links to each tool
**Named Colors Page (/names):**
- Display all 148 CSS/X11 named colors
- Search by name or hex value
- Sort options (name, hue)
- Responsive grid layout (2-6 columns)
- Click to copy color
- Color name and hex display
- Loading and error states
- Empty state for no results
- Real-time filtering
**Batch Operations Page (/batch):**
- Placeholder "Coming Soon" page
- Feature preview list
- Planned capabilities description
- Professional coming soon message
**Features Implemented:**
- Real WCAG calculations (not approximations)
- Live contrast ratio updates
- Interactive color swapping
- Comprehensive compliance checking
- Educational content
- Named colors from API
- Search and filtering
- Responsive layouts
**Build Status:**
✅ 11 pages successfully rendering
✅ All TypeScript checks passing
✅ No build errors
All major sections now have functional or placeholder pages!
Next: Polish, testing, and additional enhancements.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 11:42:55 +01:00
|
|
|
<div className="max-w-7xl mx-auto space-y-8">
|
|
|
|
|
<div>
|
|
|
|
|
<h1 className="text-4xl font-bold mb-2">Accessibility Tools</h1>
|
|
|
|
|
<p className="text-muted-foreground">
|
|
|
|
|
Ensure your colors are accessible to everyone
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
|
|
|
{tools.map((tool) => {
|
|
|
|
|
const Icon = tool.icon;
|
|
|
|
|
return (
|
|
|
|
|
<Link
|
|
|
|
|
key={tool.href}
|
2025-11-07 14:49:07 +01:00
|
|
|
href={tool.href}
|
|
|
|
|
className="p-6 border rounded-lg bg-card hover:border-primary transition-colors"
|
feat: implement accessibility tools and named colors explorer
Add comprehensive accessibility features and color naming:
**Color Utilities (lib/utils/color.ts):**
- getRelativeLuminance() - WCAG 2.1 luminance calculation
- getContrastRatio() - Contrast ratio between two colors
- hexToRgb() - Convert hex to RGB
- checkWCAGCompliance() - AA/AAA compliance checker
- Full WCAG 2.1 specification implementation
**New UI Component:**
- Badge component - Status indicators
- Variants: default, success, warning, destructive, outline
- Used for pass/fail indicators
- Accessible focus states
**Accessibility Pages:**
1. Contrast Checker (/accessibility/contrast)
- Dual color pickers (foreground/background)
- Real-time contrast ratio calculation
- Live text preview with both colors
- WCAG 2.1 compliance display:
- Level AA: Normal text (4.5:1), Large text (3:1), UI (3:1)
- Level AAA: Normal text (7:1), Large text (4.5:1)
- Pass/Fail badges for each criterion
- Swap colors button
- Visual feedback with color-coded results
2. Accessibility Dashboard (/accessibility)
- Overview of all accessibility tools
- Feature cards with icons
- Educational content about WCAG 2.1
- Standards explanation (AA vs AAA)
- Links to each tool
**Named Colors Page (/names):**
- Display all 148 CSS/X11 named colors
- Search by name or hex value
- Sort options (name, hue)
- Responsive grid layout (2-6 columns)
- Click to copy color
- Color name and hex display
- Loading and error states
- Empty state for no results
- Real-time filtering
**Batch Operations Page (/batch):**
- Placeholder "Coming Soon" page
- Feature preview list
- Planned capabilities description
- Professional coming soon message
**Features Implemented:**
- Real WCAG calculations (not approximations)
- Live contrast ratio updates
- Interactive color swapping
- Comprehensive compliance checking
- Educational content
- Named colors from API
- Search and filtering
- Responsive layouts
**Build Status:**
✅ 11 pages successfully rendering
✅ All TypeScript checks passing
✅ No build errors
All major sections now have functional or placeholder pages!
Next: Polish, testing, and additional enhancements.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 11:42:55 +01:00
|
|
|
>
|
|
|
|
|
<div className="flex items-start justify-between mb-4">
|
|
|
|
|
<Icon className="h-8 w-8 text-primary" />
|
|
|
|
|
</div>
|
|
|
|
|
<h2 className="text-xl font-semibold mb-2">{tool.title}</h2>
|
|
|
|
|
<p className="text-sm text-muted-foreground mb-4">{tool.description}</p>
|
|
|
|
|
<ul className="space-y-1">
|
|
|
|
|
{tool.features.map((feature) => (
|
|
|
|
|
<li key={feature} className="text-sm text-muted-foreground flex items-center">
|
|
|
|
|
<span className="mr-2">•</span>
|
|
|
|
|
{feature}
|
|
|
|
|
</li>
|
|
|
|
|
))}
|
|
|
|
|
</ul>
|
|
|
|
|
</Link>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Educational Content */}
|
|
|
|
|
<div className="p-6 border rounded-lg bg-card mt-8">
|
|
|
|
|
<h2 className="text-xl font-semibold mb-4">About WCAG 2.1</h2>
|
|
|
|
|
<div className="space-y-4 text-sm text-muted-foreground">
|
|
|
|
|
<p>
|
|
|
|
|
The Web Content Accessibility Guidelines (WCAG) 2.1 provide standards for making web
|
|
|
|
|
content more accessible to people with disabilities.
|
|
|
|
|
</p>
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
|
|
|
<div>
|
|
|
|
|
<h3 className="font-semibold text-foreground mb-2">Level AA (Minimum)</h3>
|
|
|
|
|
<ul className="space-y-1">
|
|
|
|
|
<li>• Normal text: 4.5:1 contrast ratio</li>
|
|
|
|
|
<li>• Large text: 3:1 contrast ratio</li>
|
|
|
|
|
<li>• UI components: 3:1 contrast ratio</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<h3 className="font-semibold text-foreground mb-2">Level AAA (Enhanced)</h3>
|
|
|
|
|
<ul className="space-y-1">
|
|
|
|
|
<li>• Normal text: 7:1 contrast ratio</li>
|
|
|
|
|
<li>• Large text: 4.5:1 contrast ratio</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|