$ show imathis/color-picker
This is a sophisticated web-based color picker application built with React, TypeScript, and Vite. It supports multiple color models (HSL, HSV, HWB, RGB, HEX, and OKLCH) with real-time updates, wide gamut support via OKLCH/P3, and advanced color handling features. The application features a clean architecture with Zustand for state management, specialized utilities for color conversion and parsing, and innovative UI techniques like CSS variable-based gradients for performance and hue preservation logic to prevent unwanted shifts during adjustments. Key strengths include cross-format pasting support, URL-based state sharing, and touch-optimized interactions.
The LLM identified 4 files worth highlighting for reuse:
Implements color space conversions between RGB, HSL, HSV, HWB, OKLCH, and HEX formats using the culori library. Features non-obvious hue preservation logic that maintains original hue values during achromatic adjustments to prevent unwanted shifts, and OKLCH precision handling that bypasses RGB roundtrip conversions when adjusting pure OKLCH values to avoid precision loss in wide-gamut colors. Demonstrates sophisticated problem-solving for common color manipulation challenges.
Parses color strings into their component values for all supported formats (hex, rgb, hsl, hwb, hsv, oklch) while preserving exact input values for better user experience. Includes special handling for HSV and OKLCH formats (which aren't natively parsed by some libraries), HWB value normalization to ensure valid ranges, and robust format detection. Represents a standalone color parsing solution that could be extracted for use in any project needing color input handling.
Generates CSS gradients for slider backgrounds using CSS variables for efficient updates without React re-renders. Implements gamut-aware gradients for OKLCH that visually indicate where colors fall outside sRGB or P3 gamuts, uses OKLAB interpolation for smoother lightness transitions, and provides model-specific gradient generation for all supported color spaces. Shows innovative approach to balancing visual accuracy with performance in color selection interfaces.
Custom React hook that provides enhanced touch handling for range sliders by preventing scroll conflicts during interaction and improving responsiveness across device types. Works by detecting touch capability and pointer precision, then applying appropriate touch event listeners with passive: false to allow preventDefault. Solves the common problem of touch-enabled sliders causing unwanted page scrolling while maintaining precise control.