Image Color Theme is a simple API that extracts primary, secondary, and tertiary colors from images. It provides a straightforward way to integrate color extraction functionality into your applications.
To use Image Color Theme, send a GET request to the following endpoint:
Replace yourImageUrl
with the URL of the image from which you want to extract colors.
const imageUrl = 'https://example.com/image.jpg';
fetch(`https://image-color-theme.vercel.app/api?url=${imageUrl}`)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
The API returns a JSON object containing primary, secondary, and tertiary colors along with their RGB and hexadecimal representations.
{
"primary": {
"rgb": "255,255,255",
"hex": "#FFFFFF"
},
"secondary": {
"rgb": "0,0,0",
"hex": "#000000"
},
"tertiary": {
"rgb": "128,128,128",
"hex": "#808080"
}
}
- express: Web framework for Node.js
- get-image-colors: Library for extracting colors from images
- Clone the repository:
git clone https://github.com/your-username/image-color-theme.git
- Install dependencies:
npm install
- Start the server:
npm start
By default, the server will listen on port 5566. You can customize the port using the PORT
environment variable.