Files
pastel-ui/app/accessibility/colorblind/page.tsx

215 lines
8.0 KiB
TypeScript
Raw Normal View History

feat: implement missing features and improvements Add comprehensive feature set and fixes: **Theme Improvements:** - Fix theme flickering by adding blocking script in layout - Prevents FOUC (Flash of Unstyled Content) - Smooth transitions between light and dark modes **Tailwind CSS v4 Migration:** - Convert globals.css to Tailwind CSS v4 format - Use @import "tailwindcss" instead of @tailwind directives - Implement @theme block with OkLCH color space - Add @plugin directives for forms and typography - Use :root and .dark class-based theming - Add all custom animations in CSS - Create postcss.config.mjs with @tailwindcss/postcss **Dev Environment:** - Add .env.local with API on port 3001 - Add dev:api and dev:all scripts to package.json - Create .env for API with port 3001 configuration - Enable running both UI and API simultaneously **New Features Implemented:** 1. **Harmony Palettes** (app/palettes/harmony/page.tsx) - Generate color harmonies based on color theory - Support for 6 harmony types: - Monochromatic - Analogous (±30°) - Complementary (180°) - Split-complementary - Triadic (120° spacing) - Tetradic/Square (90° spacing) - Uses complement and rotate API endpoints - Export harmonies in multiple formats 2. **Color Blindness Simulator** (app/accessibility/colorblind/page.tsx) - Simulate 3 types of color blindness: - Protanopia (red-blind, ~1% males) - Deuteranopia (green-blind, ~1% males) - Tritanopia (blue-blind, rare) - Side-by-side comparison of original vs simulated - Support for multiple colors (up to 10) - Educational information about each type - Accessibility tips and best practices 3. **Batch Operations** (app/batch/page.tsx) - Process up to 100 colors at once - Text input (line-separated or comma-separated) - 5 operations supported: - Lighten/Darken - Saturate/Desaturate - Rotate hue - Adjustable amount slider - Export processed colors - Live validation and color count **API Query Hooks:** - Add useSimulateColorBlindness hook - Add useTextColor hook - Export ColorBlindnessRequest and TextColorRequest types **Files Added:** - postcss.config.mjs - .env.local - ../pastel-api/.env - app/accessibility/colorblind/page.tsx - app/palettes/harmony/page.tsx **Files Modified:** - app/globals.css (Tailwind v4 migration) - app/layout.tsx (theme flicker fix) - app/batch/page.tsx (functional implementation) - lib/api/queries.ts (new hooks) - package.json (dev scripts) - tailwind.config.ts (simplified, CSS-first) All features build successfully and are ready for testing. Development server can now run with API via `pnpm dev:all`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 13:47:16 +01:00
'use client';
import { useState } from 'react';
import { ColorPicker } from '@/components/color/ColorPicker';
import { ColorDisplay } from '@/components/color/ColorDisplay';
import { Button } from '@/components/ui/button';
import { Select } from '@/components/ui/select';
import { useSimulateColorBlindness } from '@/lib/api/queries';
import { Loader2, Eye, Plus, X } from 'lucide-react';
import { toast } from 'sonner';
type ColorBlindnessType = 'protanopia' | 'deuteranopia' | 'tritanopia';
export default function ColorBlindPage() {
const [colors, setColors] = useState<string[]>(['#ff0099']);
const [blindnessType, setBlindnessType] = useState<ColorBlindnessType>('protanopia');
const [simulations, setSimulations] = useState<
fix: correct API integration and complete missing features Fix API response format mismatches and implement all remaining features: **API Integration Fixes:** - Fix ManipulationPanel to use `colors` instead of `results` from API responses - Fix gradient endpoint to use `gradient` array from API response - Fix color blindness simulator to use correct field names (`input`/`output` vs `original`/`simulated`) - Fix text color optimizer request field (`backgrounds` vs `background_colors`) - Fix method name casing: `simulateColorBlindness` (capital B) - Add palette generation endpoint integration **Type Definition Updates:** - Update GradientData to match API structure with `gradient` array - Update ColorBlindnessData to use `colors` with `input`/`output`/`difference_percentage` - Update TextColorData to use `colors` with `textcolor`/`wcag_aa`/`wcag_aaa` fields - Add PaletteGenerateRequest and PaletteGenerateData types **Completed Features:** - Harmony Palettes: Now uses dedicated `/palettes/generate` API endpoint - Simplified from 80 lines of manual color theory to single API call - Supports 6 harmony types: monochromatic, analogous, complementary, split-complementary, triadic, tetradic - Text Color Optimizer: Full implementation with WCAG compliance checking - Automatic black/white text color selection - Live preview with contrast ratios - AA/AAA compliance indicators - Color Blindness Simulator: Fixed and working - Shows difference percentage for each simulation - Side-by-side comparison view - Gradient Creator: Fixed to use correct API response structure - Batch Operations: Fixed to extract output colors correctly **UI Improvements:** - Enable all accessibility tool cards (remove "Coming Soon" badges) - Enable harmony palettes card - Add safety check for gradient state to prevent undefined errors All features now fully functional and properly integrated with Pastel API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 14:33:38 +01:00
Array<{ input: string; output: string; difference_percentage: number }>
feat: implement missing features and improvements Add comprehensive feature set and fixes: **Theme Improvements:** - Fix theme flickering by adding blocking script in layout - Prevents FOUC (Flash of Unstyled Content) - Smooth transitions between light and dark modes **Tailwind CSS v4 Migration:** - Convert globals.css to Tailwind CSS v4 format - Use @import "tailwindcss" instead of @tailwind directives - Implement @theme block with OkLCH color space - Add @plugin directives for forms and typography - Use :root and .dark class-based theming - Add all custom animations in CSS - Create postcss.config.mjs with @tailwindcss/postcss **Dev Environment:** - Add .env.local with API on port 3001 - Add dev:api and dev:all scripts to package.json - Create .env for API with port 3001 configuration - Enable running both UI and API simultaneously **New Features Implemented:** 1. **Harmony Palettes** (app/palettes/harmony/page.tsx) - Generate color harmonies based on color theory - Support for 6 harmony types: - Monochromatic - Analogous (±30°) - Complementary (180°) - Split-complementary - Triadic (120° spacing) - Tetradic/Square (90° spacing) - Uses complement and rotate API endpoints - Export harmonies in multiple formats 2. **Color Blindness Simulator** (app/accessibility/colorblind/page.tsx) - Simulate 3 types of color blindness: - Protanopia (red-blind, ~1% males) - Deuteranopia (green-blind, ~1% males) - Tritanopia (blue-blind, rare) - Side-by-side comparison of original vs simulated - Support for multiple colors (up to 10) - Educational information about each type - Accessibility tips and best practices 3. **Batch Operations** (app/batch/page.tsx) - Process up to 100 colors at once - Text input (line-separated or comma-separated) - 5 operations supported: - Lighten/Darken - Saturate/Desaturate - Rotate hue - Adjustable amount slider - Export processed colors - Live validation and color count **API Query Hooks:** - Add useSimulateColorBlindness hook - Add useTextColor hook - Export ColorBlindnessRequest and TextColorRequest types **Files Added:** - postcss.config.mjs - .env.local - ../pastel-api/.env - app/accessibility/colorblind/page.tsx - app/palettes/harmony/page.tsx **Files Modified:** - app/globals.css (Tailwind v4 migration) - app/layout.tsx (theme flicker fix) - app/batch/page.tsx (functional implementation) - lib/api/queries.ts (new hooks) - package.json (dev scripts) - tailwind.config.ts (simplified, CSS-first) All features build successfully and are ready for testing. Development server can now run with API via `pnpm dev:all`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 13:47:16 +01:00
>([]);
const simulateMutation = useSimulateColorBlindness();
const handleSimulate = async () => {
try {
const result = await simulateMutation.mutateAsync({
colors,
type: blindnessType,
});
fix: correct API integration and complete missing features Fix API response format mismatches and implement all remaining features: **API Integration Fixes:** - Fix ManipulationPanel to use `colors` instead of `results` from API responses - Fix gradient endpoint to use `gradient` array from API response - Fix color blindness simulator to use correct field names (`input`/`output` vs `original`/`simulated`) - Fix text color optimizer request field (`backgrounds` vs `background_colors`) - Fix method name casing: `simulateColorBlindness` (capital B) - Add palette generation endpoint integration **Type Definition Updates:** - Update GradientData to match API structure with `gradient` array - Update ColorBlindnessData to use `colors` with `input`/`output`/`difference_percentage` - Update TextColorData to use `colors` with `textcolor`/`wcag_aa`/`wcag_aaa` fields - Add PaletteGenerateRequest and PaletteGenerateData types **Completed Features:** - Harmony Palettes: Now uses dedicated `/palettes/generate` API endpoint - Simplified from 80 lines of manual color theory to single API call - Supports 6 harmony types: monochromatic, analogous, complementary, split-complementary, triadic, tetradic - Text Color Optimizer: Full implementation with WCAG compliance checking - Automatic black/white text color selection - Live preview with contrast ratios - AA/AAA compliance indicators - Color Blindness Simulator: Fixed and working - Shows difference percentage for each simulation - Side-by-side comparison view - Gradient Creator: Fixed to use correct API response structure - Batch Operations: Fixed to extract output colors correctly **UI Improvements:** - Enable all accessibility tool cards (remove "Coming Soon" badges) - Enable harmony palettes card - Add safety check for gradient state to prevent undefined errors All features now fully functional and properly integrated with Pastel API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 14:33:38 +01:00
setSimulations(result.colors);
feat: implement missing features and improvements Add comprehensive feature set and fixes: **Theme Improvements:** - Fix theme flickering by adding blocking script in layout - Prevents FOUC (Flash of Unstyled Content) - Smooth transitions between light and dark modes **Tailwind CSS v4 Migration:** - Convert globals.css to Tailwind CSS v4 format - Use @import "tailwindcss" instead of @tailwind directives - Implement @theme block with OkLCH color space - Add @plugin directives for forms and typography - Use :root and .dark class-based theming - Add all custom animations in CSS - Create postcss.config.mjs with @tailwindcss/postcss **Dev Environment:** - Add .env.local with API on port 3001 - Add dev:api and dev:all scripts to package.json - Create .env for API with port 3001 configuration - Enable running both UI and API simultaneously **New Features Implemented:** 1. **Harmony Palettes** (app/palettes/harmony/page.tsx) - Generate color harmonies based on color theory - Support for 6 harmony types: - Monochromatic - Analogous (±30°) - Complementary (180°) - Split-complementary - Triadic (120° spacing) - Tetradic/Square (90° spacing) - Uses complement and rotate API endpoints - Export harmonies in multiple formats 2. **Color Blindness Simulator** (app/accessibility/colorblind/page.tsx) - Simulate 3 types of color blindness: - Protanopia (red-blind, ~1% males) - Deuteranopia (green-blind, ~1% males) - Tritanopia (blue-blind, rare) - Side-by-side comparison of original vs simulated - Support for multiple colors (up to 10) - Educational information about each type - Accessibility tips and best practices 3. **Batch Operations** (app/batch/page.tsx) - Process up to 100 colors at once - Text input (line-separated or comma-separated) - 5 operations supported: - Lighten/Darken - Saturate/Desaturate - Rotate hue - Adjustable amount slider - Export processed colors - Live validation and color count **API Query Hooks:** - Add useSimulateColorBlindness hook - Add useTextColor hook - Export ColorBlindnessRequest and TextColorRequest types **Files Added:** - postcss.config.mjs - .env.local - ../pastel-api/.env - app/accessibility/colorblind/page.tsx - app/palettes/harmony/page.tsx **Files Modified:** - app/globals.css (Tailwind v4 migration) - app/layout.tsx (theme flicker fix) - app/batch/page.tsx (functional implementation) - lib/api/queries.ts (new hooks) - package.json (dev scripts) - tailwind.config.ts (simplified, CSS-first) All features build successfully and are ready for testing. Development server can now run with API via `pnpm dev:all`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 13:47:16 +01:00
toast.success(`Simulated ${blindnessType}`);
} catch (error) {
toast.error('Failed to simulate color blindness');
console.error(error);
}
};
const addColor = () => {
if (colors.length < 10) {
setColors([...colors, '#000000']);
}
};
const removeColor = (index: number) => {
if (colors.length > 1) {
setColors(colors.filter((_, i) => i !== index));
}
};
const updateColor = (index: number, color: string) => {
const newColors = [...colors];
newColors[index] = color;
setColors(newColors);
};
const typeDescriptions: Record<ColorBlindnessType, string> = {
protanopia: 'Red-blind (affects ~1% of males)',
deuteranopia: 'Green-blind (affects ~1% of males)',
tritanopia: 'Blue-blind (rare, affects ~0.001%)',
};
return (
<div className="min-h-screen p-8">
<div className="max-w-7xl mx-auto space-y-8">
<div>
<h1 className="text-4xl font-bold mb-2">Color Blindness Simulator</h1>
<p className="text-muted-foreground">
Simulate how colors appear with different types of color blindness
</p>
</div>
<div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
{/* Controls */}
<div className="space-y-6">
<div className="p-6 border rounded-lg bg-card">
<div className="flex items-center justify-between mb-4">
<h2 className="text-xl font-semibold">Colors to Test</h2>
<Button
onClick={addColor}
variant="outline"
size="sm"
disabled={colors.length >= 10}
>
<Plus className="h-4 w-4 mr-2" />
Add Color
</Button>
</div>
<div className="space-y-4">
{colors.map((color, index) => (
<div key={index} className="flex items-start gap-3">
<div className="flex-1">
<ColorPicker
color={color}
onChange={(newColor) => updateColor(index, newColor)}
/>
</div>
{colors.length > 1 && (
<Button
variant="ghost"
size="icon"
onClick={() => removeColor(index)}
className="mt-8"
>
<X className="h-4 w-4" />
</Button>
)}
</div>
))}
</div>
</div>
<div className="p-6 border rounded-lg bg-card">
<h2 className="text-xl font-semibold mb-4">Blindness Type</h2>
<div className="space-y-4">
<Select
label="Type"
value={blindnessType}
onChange={(e) => setBlindnessType(e.target.value as ColorBlindnessType)}
>
<option value="protanopia">Protanopia (Red-blind)</option>
<option value="deuteranopia">Deuteranopia (Green-blind)</option>
<option value="tritanopia">Tritanopia (Blue-blind)</option>
</Select>
<p className="text-sm text-muted-foreground">
{typeDescriptions[blindnessType]}
</p>
<Button
onClick={handleSimulate}
disabled={simulateMutation.isPending || colors.length === 0}
className="w-full"
>
{simulateMutation.isPending ? (
<>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Simulating...
</>
) : (
<>
<Eye className="mr-2 h-4 w-4" />
Simulate
</>
)}
</Button>
</div>
</div>
</div>
{/* Results */}
<div className="space-y-6">
{simulations.length > 0 ? (
<>
<div className="p-6 border rounded-lg bg-card">
<h2 className="text-xl font-semibold mb-4">Simulation Results</h2>
<p className="text-sm text-muted-foreground mb-6">
Compare original colors (left) with how they appear to people with{' '}
{blindnessType} (right)
</p>
<div className="space-y-4">
{simulations.map((sim, index) => (
<div
key={index}
className="grid grid-cols-2 gap-4 p-4 bg-muted/50 rounded-lg"
>
<div className="space-y-2">
<p className="text-xs font-medium text-muted-foreground">
Original
</p>
<div className="flex items-center gap-3">
fix: correct API integration and complete missing features Fix API response format mismatches and implement all remaining features: **API Integration Fixes:** - Fix ManipulationPanel to use `colors` instead of `results` from API responses - Fix gradient endpoint to use `gradient` array from API response - Fix color blindness simulator to use correct field names (`input`/`output` vs `original`/`simulated`) - Fix text color optimizer request field (`backgrounds` vs `background_colors`) - Fix method name casing: `simulateColorBlindness` (capital B) - Add palette generation endpoint integration **Type Definition Updates:** - Update GradientData to match API structure with `gradient` array - Update ColorBlindnessData to use `colors` with `input`/`output`/`difference_percentage` - Update TextColorData to use `colors` with `textcolor`/`wcag_aa`/`wcag_aaa` fields - Add PaletteGenerateRequest and PaletteGenerateData types **Completed Features:** - Harmony Palettes: Now uses dedicated `/palettes/generate` API endpoint - Simplified from 80 lines of manual color theory to single API call - Supports 6 harmony types: monochromatic, analogous, complementary, split-complementary, triadic, tetradic - Text Color Optimizer: Full implementation with WCAG compliance checking - Automatic black/white text color selection - Live preview with contrast ratios - AA/AAA compliance indicators - Color Blindness Simulator: Fixed and working - Shows difference percentage for each simulation - Side-by-side comparison view - Gradient Creator: Fixed to use correct API response structure - Batch Operations: Fixed to extract output colors correctly **UI Improvements:** - Enable all accessibility tool cards (remove "Coming Soon" badges) - Enable harmony palettes card - Add safety check for gradient state to prevent undefined errors All features now fully functional and properly integrated with Pastel API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 14:33:38 +01:00
<ColorDisplay color={sim.input} size="md" />
<code className="text-sm font-mono">{sim.input}</code>
feat: implement missing features and improvements Add comprehensive feature set and fixes: **Theme Improvements:** - Fix theme flickering by adding blocking script in layout - Prevents FOUC (Flash of Unstyled Content) - Smooth transitions between light and dark modes **Tailwind CSS v4 Migration:** - Convert globals.css to Tailwind CSS v4 format - Use @import "tailwindcss" instead of @tailwind directives - Implement @theme block with OkLCH color space - Add @plugin directives for forms and typography - Use :root and .dark class-based theming - Add all custom animations in CSS - Create postcss.config.mjs with @tailwindcss/postcss **Dev Environment:** - Add .env.local with API on port 3001 - Add dev:api and dev:all scripts to package.json - Create .env for API with port 3001 configuration - Enable running both UI and API simultaneously **New Features Implemented:** 1. **Harmony Palettes** (app/palettes/harmony/page.tsx) - Generate color harmonies based on color theory - Support for 6 harmony types: - Monochromatic - Analogous (±30°) - Complementary (180°) - Split-complementary - Triadic (120° spacing) - Tetradic/Square (90° spacing) - Uses complement and rotate API endpoints - Export harmonies in multiple formats 2. **Color Blindness Simulator** (app/accessibility/colorblind/page.tsx) - Simulate 3 types of color blindness: - Protanopia (red-blind, ~1% males) - Deuteranopia (green-blind, ~1% males) - Tritanopia (blue-blind, rare) - Side-by-side comparison of original vs simulated - Support for multiple colors (up to 10) - Educational information about each type - Accessibility tips and best practices 3. **Batch Operations** (app/batch/page.tsx) - Process up to 100 colors at once - Text input (line-separated or comma-separated) - 5 operations supported: - Lighten/Darken - Saturate/Desaturate - Rotate hue - Adjustable amount slider - Export processed colors - Live validation and color count **API Query Hooks:** - Add useSimulateColorBlindness hook - Add useTextColor hook - Export ColorBlindnessRequest and TextColorRequest types **Files Added:** - postcss.config.mjs - .env.local - ../pastel-api/.env - app/accessibility/colorblind/page.tsx - app/palettes/harmony/page.tsx **Files Modified:** - app/globals.css (Tailwind v4 migration) - app/layout.tsx (theme flicker fix) - app/batch/page.tsx (functional implementation) - lib/api/queries.ts (new hooks) - package.json (dev scripts) - tailwind.config.ts (simplified, CSS-first) All features build successfully and are ready for testing. Development server can now run with API via `pnpm dev:all`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 13:47:16 +01:00
</div>
</div>
<div className="space-y-2">
<p className="text-xs font-medium text-muted-foreground">
fix: correct API integration and complete missing features Fix API response format mismatches and implement all remaining features: **API Integration Fixes:** - Fix ManipulationPanel to use `colors` instead of `results` from API responses - Fix gradient endpoint to use `gradient` array from API response - Fix color blindness simulator to use correct field names (`input`/`output` vs `original`/`simulated`) - Fix text color optimizer request field (`backgrounds` vs `background_colors`) - Fix method name casing: `simulateColorBlindness` (capital B) - Add palette generation endpoint integration **Type Definition Updates:** - Update GradientData to match API structure with `gradient` array - Update ColorBlindnessData to use `colors` with `input`/`output`/`difference_percentage` - Update TextColorData to use `colors` with `textcolor`/`wcag_aa`/`wcag_aaa` fields - Add PaletteGenerateRequest and PaletteGenerateData types **Completed Features:** - Harmony Palettes: Now uses dedicated `/palettes/generate` API endpoint - Simplified from 80 lines of manual color theory to single API call - Supports 6 harmony types: monochromatic, analogous, complementary, split-complementary, triadic, tetradic - Text Color Optimizer: Full implementation with WCAG compliance checking - Automatic black/white text color selection - Live preview with contrast ratios - AA/AAA compliance indicators - Color Blindness Simulator: Fixed and working - Shows difference percentage for each simulation - Side-by-side comparison view - Gradient Creator: Fixed to use correct API response structure - Batch Operations: Fixed to extract output colors correctly **UI Improvements:** - Enable all accessibility tool cards (remove "Coming Soon" badges) - Enable harmony palettes card - Add safety check for gradient state to prevent undefined errors All features now fully functional and properly integrated with Pastel API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 14:33:38 +01:00
As Seen ({sim.difference_percentage.toFixed(1)}% difference)
feat: implement missing features and improvements Add comprehensive feature set and fixes: **Theme Improvements:** - Fix theme flickering by adding blocking script in layout - Prevents FOUC (Flash of Unstyled Content) - Smooth transitions between light and dark modes **Tailwind CSS v4 Migration:** - Convert globals.css to Tailwind CSS v4 format - Use @import "tailwindcss" instead of @tailwind directives - Implement @theme block with OkLCH color space - Add @plugin directives for forms and typography - Use :root and .dark class-based theming - Add all custom animations in CSS - Create postcss.config.mjs with @tailwindcss/postcss **Dev Environment:** - Add .env.local with API on port 3001 - Add dev:api and dev:all scripts to package.json - Create .env for API with port 3001 configuration - Enable running both UI and API simultaneously **New Features Implemented:** 1. **Harmony Palettes** (app/palettes/harmony/page.tsx) - Generate color harmonies based on color theory - Support for 6 harmony types: - Monochromatic - Analogous (±30°) - Complementary (180°) - Split-complementary - Triadic (120° spacing) - Tetradic/Square (90° spacing) - Uses complement and rotate API endpoints - Export harmonies in multiple formats 2. **Color Blindness Simulator** (app/accessibility/colorblind/page.tsx) - Simulate 3 types of color blindness: - Protanopia (red-blind, ~1% males) - Deuteranopia (green-blind, ~1% males) - Tritanopia (blue-blind, rare) - Side-by-side comparison of original vs simulated - Support for multiple colors (up to 10) - Educational information about each type - Accessibility tips and best practices 3. **Batch Operations** (app/batch/page.tsx) - Process up to 100 colors at once - Text input (line-separated or comma-separated) - 5 operations supported: - Lighten/Darken - Saturate/Desaturate - Rotate hue - Adjustable amount slider - Export processed colors - Live validation and color count **API Query Hooks:** - Add useSimulateColorBlindness hook - Add useTextColor hook - Export ColorBlindnessRequest and TextColorRequest types **Files Added:** - postcss.config.mjs - .env.local - ../pastel-api/.env - app/accessibility/colorblind/page.tsx - app/palettes/harmony/page.tsx **Files Modified:** - app/globals.css (Tailwind v4 migration) - app/layout.tsx (theme flicker fix) - app/batch/page.tsx (functional implementation) - lib/api/queries.ts (new hooks) - package.json (dev scripts) - tailwind.config.ts (simplified, CSS-first) All features build successfully and are ready for testing. Development server can now run with API via `pnpm dev:all`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 13:47:16 +01:00
</p>
<div className="flex items-center gap-3">
fix: correct API integration and complete missing features Fix API response format mismatches and implement all remaining features: **API Integration Fixes:** - Fix ManipulationPanel to use `colors` instead of `results` from API responses - Fix gradient endpoint to use `gradient` array from API response - Fix color blindness simulator to use correct field names (`input`/`output` vs `original`/`simulated`) - Fix text color optimizer request field (`backgrounds` vs `background_colors`) - Fix method name casing: `simulateColorBlindness` (capital B) - Add palette generation endpoint integration **Type Definition Updates:** - Update GradientData to match API structure with `gradient` array - Update ColorBlindnessData to use `colors` with `input`/`output`/`difference_percentage` - Update TextColorData to use `colors` with `textcolor`/`wcag_aa`/`wcag_aaa` fields - Add PaletteGenerateRequest and PaletteGenerateData types **Completed Features:** - Harmony Palettes: Now uses dedicated `/palettes/generate` API endpoint - Simplified from 80 lines of manual color theory to single API call - Supports 6 harmony types: monochromatic, analogous, complementary, split-complementary, triadic, tetradic - Text Color Optimizer: Full implementation with WCAG compliance checking - Automatic black/white text color selection - Live preview with contrast ratios - AA/AAA compliance indicators - Color Blindness Simulator: Fixed and working - Shows difference percentage for each simulation - Side-by-side comparison view - Gradient Creator: Fixed to use correct API response structure - Batch Operations: Fixed to extract output colors correctly **UI Improvements:** - Enable all accessibility tool cards (remove "Coming Soon" badges) - Enable harmony palettes card - Add safety check for gradient state to prevent undefined errors All features now fully functional and properly integrated with Pastel API. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 14:33:38 +01:00
<ColorDisplay color={sim.output} size="md" />
<code className="text-sm font-mono">{sim.output}</code>
feat: implement missing features and improvements Add comprehensive feature set and fixes: **Theme Improvements:** - Fix theme flickering by adding blocking script in layout - Prevents FOUC (Flash of Unstyled Content) - Smooth transitions between light and dark modes **Tailwind CSS v4 Migration:** - Convert globals.css to Tailwind CSS v4 format - Use @import "tailwindcss" instead of @tailwind directives - Implement @theme block with OkLCH color space - Add @plugin directives for forms and typography - Use :root and .dark class-based theming - Add all custom animations in CSS - Create postcss.config.mjs with @tailwindcss/postcss **Dev Environment:** - Add .env.local with API on port 3001 - Add dev:api and dev:all scripts to package.json - Create .env for API with port 3001 configuration - Enable running both UI and API simultaneously **New Features Implemented:** 1. **Harmony Palettes** (app/palettes/harmony/page.tsx) - Generate color harmonies based on color theory - Support for 6 harmony types: - Monochromatic - Analogous (±30°) - Complementary (180°) - Split-complementary - Triadic (120° spacing) - Tetradic/Square (90° spacing) - Uses complement and rotate API endpoints - Export harmonies in multiple formats 2. **Color Blindness Simulator** (app/accessibility/colorblind/page.tsx) - Simulate 3 types of color blindness: - Protanopia (red-blind, ~1% males) - Deuteranopia (green-blind, ~1% males) - Tritanopia (blue-blind, rare) - Side-by-side comparison of original vs simulated - Support for multiple colors (up to 10) - Educational information about each type - Accessibility tips and best practices 3. **Batch Operations** (app/batch/page.tsx) - Process up to 100 colors at once - Text input (line-separated or comma-separated) - 5 operations supported: - Lighten/Darken - Saturate/Desaturate - Rotate hue - Adjustable amount slider - Export processed colors - Live validation and color count **API Query Hooks:** - Add useSimulateColorBlindness hook - Add useTextColor hook - Export ColorBlindnessRequest and TextColorRequest types **Files Added:** - postcss.config.mjs - .env.local - ../pastel-api/.env - app/accessibility/colorblind/page.tsx - app/palettes/harmony/page.tsx **Files Modified:** - app/globals.css (Tailwind v4 migration) - app/layout.tsx (theme flicker fix) - app/batch/page.tsx (functional implementation) - lib/api/queries.ts (new hooks) - package.json (dev scripts) - tailwind.config.ts (simplified, CSS-first) All features build successfully and are ready for testing. Development server can now run with API via `pnpm dev:all`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 13:47:16 +01:00
</div>
</div>
</div>
))}
</div>
</div>
<div className="p-6 border rounded-lg bg-card bg-blue-50 dark:bg-blue-950/20">
<h3 className="font-semibold mb-2 flex items-center gap-2">
<Eye className="h-5 w-5" />
Accessibility Tip
</h3>
<p className="text-sm text-muted-foreground">
Ensure important information isn't conveyed by color alone. Use text
labels, patterns, or icons to make your design accessible to everyone.
</p>
</div>
</>
) : (
<div className="p-12 border rounded-lg bg-card text-center text-muted-foreground">
<Eye className="h-12 w-12 mx-auto mb-4 opacity-50" />
<p>Add colors and click Simulate to see how they appear</p>
<p className="text-sm mt-2">with different types of color blindness</p>
</div>
)}
</div>
</div>
</div>
</div>
);
}