dear-image.detect-background-color
v1.0.1
Published
Detects the image background color.
Downloads
270
Readme
DearImage.detectColorScheme
DearImage.detectColorScheme(image)
Detects the image background color.
| argument | description |
| ---: | :--- |
| image
| Everything the function .loadFrom
supports. |
Returns a promise that resolves to the detected background color.
dependencies
setup
npm
npm i dear-image.detect-background-color
ES module
import 'dear-image.detect-background-color';
import DearImage from 'dear-image';
Node
require('dear-image.detect-background-color');
let DearImage = require('dear-image');
browser
<script src="https://unpkg.com/dear-image"></script>
<script src="https://unpkg.com/just-my-luck"></script>
<script src="https://unpkg.com/@seregpie/k-means"></script>
<script src="https://unpkg.com/@seregpie/k-means-plus-plus"></script>
<script src="https://unpkg.com/dear-image.detect-color-scheme"></script>
<script src="https://unpkg.com/dear-image.detect-background-color"></script>
usage
let backgroundColor = await DearImage.detectBackgroundColor(image);
// => '#1b1b1b'