diff --git a/labs/meteor-client/client/globals.coffee b/labs/meteor-client/client/globals.coffee
index e6fe27cb0d..650ffea7dc 100755
--- a/labs/meteor-client/client/globals.coffee
+++ b/labs/meteor-client/client/globals.coffee
@@ -1,3 +1,9 @@
+# Convert a color `value` as integer to a hex color (e.g. 255 to #0000ff)
+@colourToHex = (value) ->
+ hex = parseInt(value).toString(16)
+ hex = "0" + hex while hex.length < 6
+ "##{hex}"
+
# retrieve account for selected user
@getCurrentUserFromSession = ->
Meteor.Users.findOne("userId": getInSession("userId"))
@@ -45,6 +51,9 @@
user.user.name
else null
+Handlebars.registerHelper "colourToHex", (value) =>
+ @window.colourToHex(value)
+
Handlebars.registerHelper 'equals', (a, b) -> # equals operator was dropped in Meteor's migration from Handlebars to Spacebars
a is b
diff --git a/labs/meteor-client/client/views/chat/chat_bar.coffee b/labs/meteor-client/client/views/chat/chat_bar.coffee
index 668501647b..d54904c19e 100755
--- a/labs/meteor-client/client/views/chat/chat_bar.coffee
+++ b/labs/meteor-client/client/views/chat/chat_bar.coffee
@@ -161,12 +161,6 @@ Template.message.helpers
res = str.replace /\n/gim, '
'
res = res.replace /\r/gim, '
'
- getHexColor: (c) ->
- if parseInt(c).toString(16).length is 4
- "#00#{parseInt(c).toString(16)}"
- else
- "##{parseInt(c).toString(16)}"
-
# make links received from Flash client clickable in HTML
toClickable: (str) ->
res = str.replace /