v0.4.0 - Nearest Color Fallback
What's New
Nearest Color Fallback
hex_to_color() now automatically finds the nearest named color when no exact match exists in the database. This uses LAB color distance for perceptually accurate matching.
# Hex code without exact match - finds nearest named color
hex_to_color("#ABCDEF")
#> [1] "alphabet blue"
# Disable fallback to get NA for unmatched colors
hex_to_color("#ABCDEF", fallback_nearest_color = FALSE)
#> [1] NAPerformance Improvements
- Pre-computed LAB color values with caching in
get_color_data() - Exact match fast path before computing distances
- Efficient color distance calculations
Other Changes
- White/black normalization (gray100 → white, gray0 → black)
- Added
farverandclito Suggests for enhanced functionality
Contributors
Thank you to @iamYannC for contributing the nearest color fallback functionality!
Full Changelog: v0.3.1...v0.4.0