Pick the paints you have, pick the color you want, and get the mixing ratios that get closest to it.
The client sends the target and the available colors to a small Flask service, which mixes them subtractively in CMY space and minimizes the perceptual difference (CIE76 ΔE in Lab) with SLSQP.
client/ React 19 + Vite + Tailwind 4
server/ Flask + numpy + scipy
Python 3.11+ is required.
cd server
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
flask --app app run --port 5000The API listens on http://localhost:5000.
cd client
npm install
cp .env.example .env # points the client at localhost:5000
npm run devWithout a .env file the client uses the deployed Render backend.
cd client
npm run typecheck
npm run lint
npm test
npm run buildPOST /api/mix
{
"target_hex": "#a1b2c3",
"input_colors": ["#ff0000", "#00ff00", "#0000ff"]
}Response — an array in the same order as input_colors, so duplicate colors
stay distinct:
[
{ "hex": "#ff0000", "weight": 0.52 },
{ "hex": "#00ff00", "weight": 0.31 },
{ "hex": "#0000ff", "weight": 0.17 }
]target_hex and every entry in input_colors must be 3- or 6-digit hex
colors. input_colors accepts 1 to 12 colors. Invalid input returns 400;
a failed solve returns 422.
- The CMY (
1 - RGB) mixing model is a subtractive approximation, not a pigment model. Kubelka–Munk mixing would predict watercolor more accurately. - CIE76 is used for color difference; CIEDE2000 is closer to human perception.
- The client normalizes colors to lowercase hex; the API echoes the input.