Adding Some Color

Let’s take a look at how we can use the AlbumColors library to create a three-color palette using the image colors.[76] We’ll then use these colors to set a background gradient for the DOM node containing the image.

Let’s start by adding the library JavaScript file to our project.[77] Save the file in the resources/public/vendor/js folder as color.js.

Next we’ll add the new JavaScript file to the resources/templates/home.html template file in order to load it on the page.

 <!-- scripts and styles -->
 {% style "/assets/bootstrap/css/bootstrap.min.css" %}
 {% style "/assets/font-awesome/css/font-awesome.min.css" %}
 {% style "/css/screen.css" %}
 {% script "/vendor/js/colors.js" ...

Get Web Development with Clojure, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.