Take darker of user colors (#325)
This commit is contained in:
parent
75d1a89c7a
commit
909efa6fab
1 changed files with 6 additions and 1 deletions
|
|
@ -42,10 +42,15 @@ class MessagesController < ApplicationController
|
|||
username: new_message.user.username,
|
||||
message: new_message.message_html,
|
||||
timestamp: new_message.timestamp,
|
||||
color: new_message.user.bg_color_hex,
|
||||
color: darker_user_color(new_message),
|
||||
}.to_json
|
||||
end
|
||||
|
||||
def darker_user_color(new_message)
|
||||
HexComparer.new([new_message.user.bg_color_hex || "#000000",
|
||||
new_message.user.text_color_hex || "#000000"]).brightness(0.9)
|
||||
end
|
||||
|
||||
def message_params
|
||||
params.require(:message).permit(:message_markdown, :user_id, :chat_channel_id)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue