overleaf/services/web/public/coffee/ide/chat/controllers/ChatMessageController.coffee

24 lines
995 B
CoffeeScript
Raw Normal View History

2014-07-08 07:02:26 -04:00
define [
"base"
"ide/colors/ColorManager"
], (App, ColorManager) ->
2014-07-08 07:02:26 -04:00
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) ->
2017-12-19 05:52:17 -05:00
"border-color" : "hsl(#{ hue(user) }, #{ hslColorConfigs.borderSaturation }, #{ hslColorConfigs.borderLightness })"
"background-color" : "hsl(#{ hue(user) }, #{ hslColorConfigs.bgSaturation }, #{ hslColorConfigs.bgLightness })"
$scope.getArrowStyle = (user) ->
2017-12-19 05:52:17 -05:00
"border-color" : "hsl(#{ hue(user) }, #{ hslColorConfigs.borderSaturation }, #{ hslColorConfigs.borderLightness })"
2014-07-08 07:02:26 -04:00
]