   [n cols w h]
   (->>
     (range (* cols (Math.ceil (/ n cols))))
-    (map-indexed #(if (< %1 n) 1 0))
+    (map-indexed #(if (< %1 n) (inc %2) 0))
     (partition-all cols)
     (partition-all h)
     (interpose (repeat cols 0))

                                                  "rgb(0,0,0,0)")
                                        :color  (if (and (zero? i) (zero? j))
                                                  ((if (> rr 1) :text-icons :dark-primary) palette)
                                                  "white")     ; (if (highlight (+ j (* i rows))) "black" "white")
                                        })))))))))




(def dice {1 [[1]]
           2 [[1 0]
              [0 2]]
           3 [[1 2]
              [0 3]]
           4 [[1 2]
              [3 4]]
           5 [[1 0 2]
              [0 3 0]
              [4 0 5]]
           6 [[1 2 3]
              nil
              [4 5 6]]
           7 [[1 2 0]
              [3 4 5]
              [0 6 7]]
           8 [[1 2 3]
              [4 0 5]
              [6 7 8]]
           9 [[1 2 3]
              [4 5 6]
              [7 8 9]]
           })

(defn dicen
  "layout n icons in an easy to count manner (dice-like for small n).
  Full cells are represented by a non-zero value. Positive for a normal
  cell, and negative for a highlighted cell. A cell is highlighted if its
  index (in 0..(n-1)) is in the highlight set."
  [n highlight]
  (mapv
    #(mapv (fn [k] (if (highlight (dec k)) (- k) k)) %)
    (cond
      (< n 10) (get dice n)
      (<= n 20) (blocks n 5 5 2)
      (<= n 100) (blocks n 10 5 2)
      :else (blocks n 10 10 10))))

(comment
  (dicen 5 #{0 1 3})
  => [[-1 0 -2] [0 3 0] [-4 0 5]]
  )

(defn icon-top
  "Determine vertical position of icons, taking account of their size a, the layout for the number n,
