https://github.com/gregnb/area-dominant-color
Javascript - Get the Dominant color of an area
https://github.com/gregnb/area-dominant-color
canvas javascript
Last synced: about 1 year ago
JSON representation
Javascript - Get the Dominant color of an area
- Host: GitHub
- URL: https://github.com/gregnb/area-dominant-color
- Owner: gregnb
- Created: 2016-05-09T19:53:27.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-10T00:37:01.000Z (about 10 years ago)
- Last Synced: 2025-04-10T19:36:51.828Z (about 1 year ago)
- Topics: canvas, javascript
- Language: JavaScript
- Homepage:
- Size: 2.23 MB
- Stars: 1
- Watchers: 1
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Javascript - Grab Dominant color of a supplied area
Simple function that returns a sorted palette of colors by occurance in a supplied area.
var image = document.getElementById('image')
var palette = areaPalette(image, {
w: 200,
h: 100,
x: '50%',
y: '70%',
palettesize: 5,
debug: false
});
var dominantColor = palette[0].hex;
var constrastDom = palette[0].constrast;