About this project
Hueclid is an open-source tool that converts screenshots or photos into accessible UI color palettes. Unlike typical palette generators that extract dominant colors and stop there, Hueclid treats palette generation as a constrained optimization problem, producing a set of design-system roles—background, surface, text, primary action, danger, and more—that are verified against each other for contrast using APCA (Accessible Perceptual Contrast Algorithm) rather than the older WCAG 2 contrast ratio.
The core algorithm, called ACCORD, searches for a palette that stays faithful to the source image's actual colors while satisfying every contrast constraint in a directed role graph simultaneously. It uses CP-SAT (Constraint Programming with SAT) for exact solving, meaning the result is either provably correct or provably infeasible, with a clear indication of which constraint is the problem when no valid palette exists.
The project is early-stage but has a working FastAPI backend and Next.js frontend, hosted publicly at hueclid.cinexg.com. The color math is implemented and verified: sRGB to CIELAB conversion, CIEDE2000 color difference (checked against Sharma et al. 2005 reference data), Oklab and Oklch (checked against CSS Color 4 reference matrices), gamut mapping in Oklch, Lab-space histogram binning, and a weighted k-means palette extractor. A Postgres-backed cache of Lab-space histogram bins is built for dataset ingestion, validated against Rico, Enrico, and WebUI datasets with over 100,000 real screenshots.
The project distinguishes itself from related work like Colorgorical and Palettailor by treating APCA as a hard constraint inside generation (not a post-filter), generating typed design-system roles with a directed constraint graph (not a flat set of distinguishable colors), and solving the constrained selection step exactly (not through stochastic search).
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.