Skip to content

A JQuery plugin that calculate the average color of an HTML img tag

Notifications You must be signed in to change notification settings

m2omou/average-color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JQuery average-color

A JQuery plugin that calculate the average color of an HTML img tag.

Installation

<script type="text/javascript" src="../js/jquery-latest.js"></script>
<script type="text/javascript" src="../js/jquery.average-color.js"></script>

Code examples

####Example 1:####

<img id="myImg" src="../img/nature.jpg" alt="nature" />
<script>
  var color = $("#myImg").averageColor();
  $("body").css("background", color);
</script>

####Example 2:####

It is also possible to get the average color without using the Jquery plugin.

<script>
  var color = averageColor("path/myImage.jpg");
  $("body").css("background", color);
</script>

License

Jquery Average-color Copyright 2014 Mourad Sabour, mourad.sabour[at]gmail.com.

About

A JQuery plugin that calculate the average color of an HTML img tag

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published