This shows how to use Single Color Image programatically. Click here to go back to the demo.
This:
https://singlecolorimage.com/get/33fd8f/400x100
Returns this:
The API is simple. It takes two arguments:
ff85a9
or
41427a
.
These can be uppercase or lowercase but must be 6 hex digits.
Then, load the URL like this:
https://singlecolorimage.com/get/{{hex digits}}/{{width}}x{{height}}
This will return a PNG image. If you make a bad API call (improper formatting, image too large, etc), you will get a 1x1 black PNG with the appropriate HTTP status code.
You may optionally include a suffix, .png
. For example, these
two URLs are equivalent:
https://singlecolorimage.com/get/33fd8f/400x100
https://singlecolorimage.com/get/33fd8f/400x100.png
You may be rate limited at 100 requests per IP address per hour. You may exceed this limit, but that isn't guaranteed. If you are rate limited, you'll receive a 429 status code and a 1x1 black PNG.
All API responses are free license and released into the public domain under the CC0 license.