A jQuery plugin for extracting dominant colors from images and applying it to its parent. Install via bower. Then simply include jQuery and the script in your page, and invoke it like so. Instead of using an <img> element nested inside of parent element, AB supports grabbing the dominant color of a background image of a standalone element, then applying the corresponding dominant color as the background color of said element. Enable this functionality by adding a data property, data-ab-css-background to the element. selector String (default: 'img[data-adaptive-background="1"]') a CSS selector which denotes which images to grab/process. Ideally, this selector would start with img, to ensure we only grab and try to process actual images. parent falsy (default: null) a CSS selector which denotes which parent to apply the background color to. By default, the color is applied to the parent one level up the DOM tree.

Features

  • This plugin is built on top of a script called RGBaster
  • You may wish to supply a callback function which is called once the magic has been performed
  • To enable CORS for images hosted on S3 buckets, follow the Amazon guide
  • For all images, you can optionally also include a cross-origin attribute in your image
  • Shade the color of the parent ligher or darker
  • Set the color that will be used to blend the background color with

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow Adaptative Backgrounds

Adaptative Backgrounds Web Site

Other Useful Business Software
Our Free Plans just got better! | Auth0 Icon
Our Free Plans just got better! | Auth0

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your security. Auth0 now, thank yourself later.
Try free now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of Adaptative Backgrounds!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Browser Extensions and Plugins, JavaScript Image Recognition Software

Registered

2021-08-23