JavaScript Library To Generate Gradients From Dominant Colors In An Image – Grade.js

Category: Color , Javascript , Recommended | August 3, 2022
Author:benhowdle89
Views Total:2,104 views
Official Page:Go to website
Last Update:August 3, 2022
License:MIT

Preview:

JavaScript Library To Generate Gradients From Dominant Colors In An Image – Grade.js

Description:

Grade.js is a JavaScript library that extracts the top 2 dominant colors from your images and then generates gradients for further use.

How to use it:

Download and include the core JavaScript file in the web project.

<script src="dist/grade.js"></script>

Wrap your image into a container named ‘gradient-wrap’.

<div class="gradient-wrap">
  <img src="1.jpg">
</div>

The JavaScript to extract the colors from the image and apply the colors as gradients to the background of its parent container.

Grade(document.querySelectorAll('.gradient-wrap'))

Changelog:

08/03/2022

  • fix(getImageData): this changes solve the getImageData error

You Might Be Interested In:


Leave a Reply