Skip to main content
Home/Recipes/ML-powered brand primary detection
Extraction

ML-powered brand primary detection

DesignerDeveloperAgency

Overview

When a palette has four strong colors and two plausible brand primaries, the heuristic picks wrong. Add --ai and a trained model identifies the actual brand primary. One flag, experimental.

Dembrandt's heuristic primary detection scores colors by saturation, frequency, and contrast. It handles clean two-color palettes well and fails on complex ones where a utility color outscores the actual brand primary. The --ai flag runs inference on a trained ONNX logistic regression model bundled in the CLI (0.9 KB). The model was trained on real brand extractions and picks the brand primary from the full extracted palette, not from rules. It sets colors.semantic.primary to the predicted value and prints the confidence score. The optional runtime dependency keeps the default install lightweight: npm install onnxruntime-node once, then the flag is available. Without the flag, nothing changes.

Predict brand primary with ML

Terminal
dembrandt example.com --ai

Install the optional runtime first

Terminal
npm install onnxruntime-node

Combine with other flags

Terminal
dembrandt example.com --ai --save-output
Agent prompt: use ML primary in code generation
# Extract with --ai, load the JSON, then:
"Use the colors.semantic.primary value from this extraction
as the brand primary. It was predicted by the ML model.
Build a landing page hero section using that color as the
primary CTA color, with accessible contrast on white."
Output

colors.semantic.primary set to the ML-predicted brand primary. Terminal prints the score and accuracy.

Browse all

All recipes →

54 workflows