use solid colours on book entries
[books.alexwlchan.net] / templates / list_reading.html
index 6f8baf6..483f03b 100644 (file)
   <h2>books i&rsquo;m currently reading</h2>
 
   {% for reading_entry in all_reading %}
   <h2>books i&rsquo;m currently reading</h2>
 
   {% for reading_entry in all_reading %}
-  <div class="reading">
+  {% set r = (tint_colors[reading_entry.book.cover_image][0] * 255) | int %}
+  {% set g = (tint_colors[reading_entry.book.cover_image][1] * 255) | int %}
+  {% set b = (tint_colors[reading_entry.book.cover_image][2] * 255) | int %}
+
+  <style>
+    #reading_{{ r }}_{{ g }}_{{ b }} {
+      background: rgb(
+        {{ (r * 0.08 + 0.92 * 255) | int }},
+        {{ (g * 0.08 + 0.92 * 255) | int }},
+        {{ (b * 0.08 + 0.92 * 255) | int }}
+      );
+      border-color: rgb({{ r }}, {{ g }}, {{ b }});
+    }
+  </style>
+
+  <div class="reading" id="reading_{{ r }}_{{ g }}_{{ b }}">
     <div class="reading_inner">
       <div class="book_thumbnail">
         {% set book = reading_entry.book %}
     <div class="reading_inner">
       <div class="book_thumbnail">
         {% set book = reading_entry.book %}
@@ -18,7 +33,7 @@
       </div>
 
       <div class="book_metadata">
       </div>
 
       <div class="book_metadata">
-        <p class="title">{{ reading_entry.book.title }}</p>
+        <p class="title">{{ reading_entry.book.title | smartypants | safe }}</p>
         <p>
           <small>
             by {{ reading_entry.book.author }}
         <p>
           <small>
             by {{ reading_entry.book.author }}