Grade.js

This JavaScript library produces complementary gradients generated from the top 2 dominant colours in supplied images.

Download

npm install grade-js

Usage

<!--the gradient is applied to this div as a background-image-->
<div class="gradient-wrap">
    <!--this inner image is used to create the gradient-->
    <img src="./samples/good-dinosaur.jpg" />
</div>

<script src="../dist/grade.js"></script>
<script type="text/javascript">
    window.addEventListener('load', function(){
        Grade(document.querySelectorAll('.gradient-wrap'))
    })
</script>