                         (doseq [x (range (count "Rainbow"))
                                 :let [rgb (hsv->rgb (double (rand 360)) 1.0 1.0)]]
                             (zat/set-fx-fg! terminal :rainbow (inc x) 1 rgb)))
-                        (zat/assoc-fx-uniform! terminal "time" (swap! time inc))
                         (zat/refresh! terminal)
                       (Thread/sleep 10)
                       (recur))

        (log/info "got key" (or (str @last-key) "nil"))
        ;; change font size on s/m/l keypress
        (case new-key
          \s (zat/apply-font! terminal
               (CP437Font. "http://dwarffortresswiki.org/images/b/be/Pastiche_8x8.png" :green 1)
               (CP437Font. "http://dwarffortresswiki.org/images/b/be/Pastiche_8x8.png" :green 1))
          \m (zat/apply-font! terminal
               (CP437Font. "http://dwarffortresswiki.org/images/b/be/Pastiche_8x8.png" :green 2)
               (CP437Font. "http://dwarffortresswiki.org/images/b/be/Pastiche_8x8.png" :green 2))
          \l (zat/apply-font! terminal
               (CP437Font. "http://dwarffortresswiki.org/images/b/be/Pastiche_8x8.png" :green 3)
               (CP437Font. "http://dwarffortresswiki.org/images/b/be/Pastiche_8x8.png" :green 3))
          \f (zat/fullscreen! terminal (first fullscreen-sizes))
          \w (zat/fullscreen! terminal false)
          \0 (zat/assoc-fx-uniform! terminal "brightness" (swap! brightness #(- % 0.02)))
          \1 (zat/assoc-fx-uniform! terminal "brightness" (swap! brightness #(+ % 0.02)))
          \2 (do (swap! contrast #(- % 0.02))
                 (log/info "contrast" @contrast)
                 (zat/assoc-fx-uniform! terminal "contrast" @contrast))
          \3 (zat/assoc-fx-uniform! terminal "contrast" (swap! contrast #(+ % 0.02)))
          \4 (zat/assoc-fx-uniform! terminal "scanlineDepth" (swap! scanlineDepth #(- % 0.02)))
          \5 (zat/assoc-fx-uniform! terminal "scanlineDepth" (swap! scanlineDepth #(+ % 0.02)))
          \6 (zat/assoc-fx-uniform! terminal "colorShift" (swap! colorShift #(- % 0.0001)))
          \7 (zat/assoc-fx-uniform! terminal "colorShift" (swap! colorShift #(+ % 0.0001)))
          \8 (zat/assoc-fx-uniform! terminal "noise" (swap! noise #(- % 0.0001)))
          \9 (zat/assoc-fx-uniform! terminal "noise" (swap! noise #(+ % 0.0001)))
          \p (log/info "brightness" @brightness
                       "contrast" @contrast
                       "scanlineDepth" @scanlineDepth
                       "colorShift" @colorShift
                       "noise" @noise
                       "time" @time)
          \q (zat/destroy! terminal)
          nil)
        (if (= new-key :exit)


(defn -main [& _]
  ;; render in background thread
   (let [terminal   (zgl/make-terminal [:text :rainbow]
                                       {:title "Zaffre demo"
                                        :columns 80 :rows 24
                                        :default-fg-color [250 250 250]
                                        :default-bg-color [5 5 8]
                                        :windows-font (TTFFont. "Consolas" 12)
                                        :else-font (TTFFont. "Monospaced" 12)
                                        :icon-paths ["images/icon-16x16.png"
                                                     "images/icon-32x32.png"
                                                     "images/icon-128x128.png"]})
        last-key    (atom nil)
        ;; Every 10ms, set the "Rainbow" text to have a random fg color
        fx-chan     (go-loop []
