diff --git a/web/chat/message-list-types.js b/web/chat/message-list-types.js --- a/web/chat/message-list-types.js +++ b/web/chat/message-list-types.js @@ -5,7 +5,10 @@ import type { MarkdownRules } from '../markdown/rules.react'; export type MessageListContextType = { - +getTextMessageMarkdownRules: (useDarkStyle: boolean) => MarkdownRules, + +getTextMessageMarkdownRules: ( + useDarkStyle: boolean, + isViewer: boolean, + ) => MarkdownRules, }; export const MessageListContext: React.Context = React.createContext(); diff --git a/web/chat/text-message.react.js b/web/chat/text-message.react.js --- a/web/chat/text-message.react.js +++ b/web/chat/text-message.react.js @@ -50,7 +50,10 @@ const messageListContext = React.useContext(MessageListContext); invariant(messageListContext, 'DummyTextNode should have MessageListContext'); - const rules = messageListContext.getTextMessageMarkdownRules(darkColor); + const rules = messageListContext.getTextMessageMarkdownRules( + darkColor, + isViewer, + ); return ( MarkdownRules = _memoize( - (useDarkStyle, threadColor) => { + (useDarkStyle, isViewer, threadColor) => { const linkMarkdownRules = linkRules(useDarkStyle); const simpleMarkdownRules = { @@ -99,16 +100,22 @@ '--text-message-default-background', ); } - const backgroundColor = threadColor - ? tinycolor(threadColor).darken(20).toString() - : tinycolor(defaultTextMessageBackgroundColor) - .lighten(40) - .toString(); - const borderLeftColor = threadColor - ? tinycolor(threadColor).darken(30).toString() - : tinycolor(defaultTextMessageBackgroundColor) - .lighten(20) - .toString(); + + let backgroundColor = tinycolor(defaultTextMessageBackgroundColor) + .lighten(40) + .toString(); + let borderLeftColor = tinycolor(defaultTextMessageBackgroundColor) + .lighten(20) + .toString(); + + if (threadColor) { + backgroundColor = isViewer + ? tinycolor(threadColor).darken(20).toString() + : tinycolor(threadColor).toString(); + borderLeftColor = isViewer + ? tinycolor(threadColor).darken(30).toString() + : tinycolor(threadColor).darken(20).toString(); + } return (
MarkdownRules { +): ?(useDarkStyle: boolean, isViewer: boolean) => MarkdownRules { const threadMembers = useSelector( relativeMemberInfoSelectorForMembersOfThread(threadID), ); @@ -196,8 +203,10 @@ if (!threadMembers) { return undefined; } - return _memoize<[boolean], MarkdownRules>((useDarkStyle: boolean) => - textMessageRules(threadMembers, useDarkStyle, threadColor), + return _memoize<[boolean, boolean], MarkdownRules>( + (useDarkStyle: boolean, isViewer: boolean) => + textMessageRules(threadMembers, useDarkStyle, isViewer, threadColor), + (...args) => JSON.stringify(args), ); }, [threadMembers, threadColor]); } @@ -205,9 +214,10 @@ function textMessageRules( members: $ReadOnlyArray, useDarkStyle: boolean, + isViewer: boolean, threadColor: ?string, ): MarkdownRules { - const baseRules = markdownRules(useDarkStyle, threadColor); + const baseRules = markdownRules(useDarkStyle, isViewer, threadColor); return { ...baseRules, simpleMarkdownRules: { @@ -233,7 +243,7 @@ function getDefaultTextMessageRules(): MarkdownRules { if (!defaultTextMessageRules) { - defaultTextMessageRules = textMessageRules([], false, null); + defaultTextMessageRules = textMessageRules([], false, false, null); } return defaultTextMessageRules; }