Download Script

This jQuery plugin searches for the first child of the selected element and collects the color information from it, which is
set as the the background color of the element by it. The detection based on the src or srcset attribute of the
child element, or if it’s not an image then it based on the background-image or background css property of the
child.

This jQuery plugin searches for the first child of the selected element and collects the color information from it, which is
set as the the background color of the element by it. The detection based on the src or srcset attribute of the
child element, or if it’s not an image then it based on the background-image or background css property of the
child.

You can choose from three methods to set the background:

  • Background: This color is based on the edges of the image to provide the best transient color between the image and the background.
  • Primary: This color is the primary color of the whole image.
  • Secondary: This color is the secondary color of the whole image.

Of course you can set up gradients as well! You can choose from eight types of gradients:

  • From primary color to secondary color

    • Vertical gradient
    • Horizontal gradient
    • Diagonal gradient
    • Radial gradient
  • From secondary color to primary color

    • Vertical gradient
    • Horizontal gradient
    • Diagonal gradient
    • Radial gradient

The plugin is highly configurable! You can change the source element of the colors, you
can change the container, for which the background will be set. You can force an alpha channel for the gradients.
You can exclude colors from the detection based on their alpha channel or exclude grayscaled colors or exclude a
specific or a range of colors.

And if it’s not enough, you can use four other methods for the detection of the colors to implement your own functions!

  • Detect the main colors
  • Detect the average color
  • Detect the color of each edge
  • Detect the color of the background, based on the edges

The package contains the original and the minimalized version of the plugin (adaptive-colors.js and adaptive-colors.min.js)
and the documentation with live demos of it. The documentation is the same as the live preview and it contains a html,
a demo css, a demo js and a demo image. You can use this in your projects as well.

The documentation and the live preview are using jQuery, Bootstrap, Font Awsome via CDN, and the Pacifco and
Raleway fonts via Google webfonts. These assets are NOT part of the package!

Download Script