overleaf/services/web/public/coffee/ide/chat/controllers/ChatMessageController.coffee
2017-12-19 10:52:17 +00:00

24 lines
No EOL
995 B
CoffeeScript

define [
"base"
"ide/colors/ColorManager"
], (App, ColorManager) ->
App.controller "ChatMessageController", ["$scope", "ide", ($scope, ide) ->
hslColorConfigs =
borderSaturation: window.uiConfig?.chatMessageBorderSaturation or "70%"
borderLightness : window.uiConfig?.chatMessageBorderLightness or "70%"
bgSaturation : window.uiConfig?.chatMessageBgSaturation or "60%"
bgLightness : window.uiConfig?.chatMessageBgLightness or "97%"
hue = (user) ->
if !user?
return 0
else
return ColorManager.getHueForUserId(user.id)
$scope.getMessageStyle = (user) ->
"border-color" : "hsl(#{ hue(user) }, #{ hslColorConfigs.borderSaturation }, #{ hslColorConfigs.borderLightness })"
"background-color" : "hsl(#{ hue(user) }, #{ hslColorConfigs.bgSaturation }, #{ hslColorConfigs.bgLightness })"
$scope.getArrowStyle = (user) ->
"border-color" : "hsl(#{ hue(user) }, #{ hslColorConfigs.borderSaturation }, #{ hslColorConfigs.borderLightness })"
]