 (defn message []
   (or (:message @prefs) ""))
 
+(defn color []
+  (or (:color @prefs)
+      (swap! prefs assoc :color (str "#"(.toString (rand-int 16rFFFFFF) 16)))))
+
 (defn speed []
   4)
 
 (defn player-name []
   (or (:name @prefs) "rfb"))
 
-(defn player-view [[id {:keys [name message]
+(defn player-view [[id {:keys [name message color]
                         [x y] :coords
                         :as player}] owner]
   (reify

(def firebase (js/Firebase. "https://burning-heat-936.firebaseio.com/players"))
(def prefs (local-storage (atom {}) :prefs))

(defn player-id [] (or (:player-id @prefs) (swap! prefs assoc :player-id (uuid/make-random))))

(defn coords []
  (let [[x y] (:coords @prefs)]

         (events/listen (KeyHandler. js/document) EventType.KEY
                        (fn [event]
                          (case (.-keyCode event)
                            37 (do (update-coords! back identity) (.preventDefault event))
                            38 (do (update-coords! identity back) (.preventDefault event))
                            39 (do (update-coords! fwd identity) (.preventDefault event))
                            40 (do  (update-coords! identity fwd) (.preventDefault event))
                            ;;191 (.focus (om/get-node owner "message"))
                            nil))))))
   app-state
