Skip to content

hunnble/dominantcolors.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dominantcolors.js

npm-image Build Status downloads-image downloads-image downloads-image downloads-image

Extract dominant colors from image. source code | docs | online examples

install

install dominantcolors.js via yarn

yarn add dominantcolors.js

you can also use unpkg, just replace "version" with the current version on the link below:

<script
  type="text/javascript"
  src="https://unpkg.com/dominantcolors.js@version/dist/dominantcolors.umd.js"
></script>

quick start

const dominantcolorsJs = require("dominantcolors.js");

dominantcolorsJs("./example.jpg", {
  count: 4,
  omitTransparentPixel: true,
  colorFormat: "hex" // hex or rgb
})
  .then(result => {
    // result is an array of colors
    // eg: ['#4B2A29', '#180C0C', '#582929', '#160808']
  })
  .catch(error => {
    // handle the error
  });

About

Extract dominant colors from image.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published