Colormind API
Colormind has a REST API. The API allows you to access all the features that you see on Colormind.io.
The API is free for personal and non-commercial use. If you're looking to use it in a commercial application, get in touch by email: jack@colormind.io
To get a random color palette:
curl 'http://colormind.io/api/' --data-binary '{"model":"default"}'
# {"result":[[214,78,69],[247,242,163],[201,216,147],[57,141,112],[62,80,64]]}
To get color suggestions with input, label blank fields with the "N" character:
curl 'http://colormind.io/api/' --data-binary '{"input":[[44,43,44],[90,83,82],"N","N","N"],"model":"default"}'
# {"result":[[49,47,49],[91,83,81],[133,155,143],[226,209,167],[235,198,126]]}
You can use different models by passing in the model name. The models "default" and "ui" are always available, but others will change each day.
To see which models are currently available, check the list endpoint:
curl 'http://colormind.io/list/'
# {"result":["default","ui","makoto_shinkai","metroid_fusion","akira_film","flower_photography"]}
The models are refreshed every day at +8 UTC (midnight PDT). The service will be down for 30 seconds while the new models are loaded into memory.
Query the API in Javascript like so:
var url = "http://colormind.io/api/";
var data = {
model : "default",
input : [[44,43,44],[90,83,82],"N","N","N"]
}
var http = new XMLHttpRequest();
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
var palette = JSON.parse(http.responseText).result;
}
}
http.open("POST", url, true);
http.send(JSON.stringify(data));
// [[42, 41, 48], [90, 83, 84], [191, 157, 175], [188, 138, 125], [215, 170, 66]]
// note that the input colors have changed as well, by a small amount