use solid colours on book entries
[books.alexwlchan.net] / templates / list_reading.html
index ba77e50..483f03b 100644 (file)
@@ -4,13 +4,28 @@
   <p class="nav">
     <a href="/reviews">read</a> /
     <a class="selected" href="/reading">reading</a> /
-    <a href="/plans">to read</a>
+    <a href="/to-read">to read</a>
   </p>
 
   <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 %}
@@ -18,7 +33,7 @@
       </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 }}