diff --git a/flatland/utils/rendertools.py b/flatland/utils/rendertools.py
index 4256f0d2b312981d60e21b9649194b7d2c1558f2..f2200b97b03577e4dcdb2f34575b0330ff0693fe 100644
--- a/flatland/utils/rendertools.py
+++ b/flatland/utils/rendertools.py
@@ -781,8 +781,9 @@ class RenderTool(object):
                 position = agent.position
                 direction = agent.direction
                 old_direction = agent.direction
-            
-            self.gl.setAgentAt(iAgent, *position, old_direction, direction)
+
+            cmap = self.gl.get_cmap('hsv', lut=max(len(self.env.agents), len(self.env.agents_static) + 1))
+            self.gl.setAgentAt(iAgent, *position, old_direction, direction,color=cmap(iAgent))
 
         if show:
             self.gl.show()
diff --git a/flatland/utils/svg.py b/flatland/utils/svg.py
index 89730af2c41a442e65d8c5976f24b1ea84468330..0a6b895dcdaa5e9cd4d99cfa5861ecc187dad905 100644
--- a/flatland/utils/svg.py
+++ b/flatland/utils/svg.py
@@ -60,7 +60,7 @@ class SVG(object):
         sNewStyles = "\n"
         for sKey, sValue in self.dStyles.items():
             if sKey == style_name:
-                sValue = "fill:#" + "".join([format(col, "#04x")[2:] for col in color]) + ";"
+                sValue = "fill:#" + "".join([ ('{:#04x}'.format(int(255.0*col))[2:4]) for col in color[0:3]]) + ";"
             sNewStyle = "\t.st" + sKey + "{" + sValue + "}\n"
             sNewStyles += sNewStyle