Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sodhanalibrary/background-color-thief
Detect Background Color Of An Image Using Javascript
https://github.com/sodhanalibrary/background-color-thief
Last synced: 4 days ago
JSON representation
Detect Background Color Of An Image Using Javascript
- Host: GitHub
- URL: https://github.com/sodhanalibrary/background-color-thief
- Owner: SodhanaLibrary
- Created: 2015-04-30T18:58:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-10-31T11:26:27.000Z (3 months ago)
- Last Synced: 2025-01-15T09:57:28.175Z (11 days ago)
- Language: JavaScript
- Size: 20.5 KB
- Stars: 73
- Watchers: 4
- Forks: 18
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Background-Color-Thief
This script is to detect background color of an image. Thanks for Color-Theif (https://github.com/lokesh/color-thief/) for such a great work.
Here I have used some code from Color-Theif.##How To Use
####HTML markup
```js
```####Javascript
```js
var backgroundColorThief = new BackgroundColorTheif();
var rgb = backgroundColorThief.getBackGroundColor(document.getElementById("backgroundImage"));
document.getElementById("backGroundColor").style.backgroundColor = 'rgb(' + rgb[0] + ',' + rgb[1] + ',' + rgb[2] +')';
```
##Demo[Click here] (http://demo.ftmocks.com/get-background-color.html) to seee demo
##Algoirithm behind this script
Most dominant color of edges and corners of image can be background color of the image. [Click here] (http://blog.ftmocks.com/2015/05/detect-background-color-of-image-using.html#.VUNPFSGqqko) for more explanation
##Applications
I have implemented some online tools using this script. Take a look at below links
[Facebook Optimized Images](http://flaticon.ftmocks.com/generate-facebook-optimized-images.html)
[Facebook App Icons and Banners](http://flaticon.ftmocks.com/generate-facebook-icons-and-banners.html)
[Phonegap Icons and Screens](http://flaticon.ftmocks.com/generate-phonegap-icons-screens.html)