Skip to content

Commit 3a6d4c3

Browse files
committed
fix: sender and receiver message theme colors
1 parent 3c05a9f commit 3a6d4c3

File tree

7 files changed

+26
-12
lines changed

7 files changed

+26
-12
lines changed

docusaurus/docs/reactnative/basics/migrating-from-5.x-to-6.x.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ The type of `quotedMessage` is changed from `MessageType | boolean` to `Message
198198

199199
### Refactor of theme object
200200

201+
The color of the sender and receiver messages are now changed to `light_blue` and `light_gray` keys respectively.
202+
203+
:::note
204+
Please configure the `light_blue` and `light_gray` keys in the theme object to customize the sender and receiver messages for dark and light mode.
205+
:::
206+
201207
The default theme object has been refactored to provide a better customization experience. The theme object is now more organized and provides better control over the customization. You can check the object [here](https://github.com/GetStream/stream-chat-react-native/blob/develop/package/src/contexts/themeContext/utils/theme.ts).
202208

203209
### Remove the deprecated code

examples/ExpoMessaging/useStreamChatTheme.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export const useStreamChatTheme = () => {
2727
grey_gainsboro: '#2D2F2F',
2828
grey_whisper: '#1C1E22',
2929
icon_background: '#FFFFFF',
30+
light_blue: '#001333',
31+
light_gray: '#1C1E22',
3032
modal_shadow: '#000000',
3133
overlay: '#FFFFFFCC', // CC = 80% opacity
3234
shadow_icon: '#00000080', // 80 = 50% opacity
@@ -50,6 +52,8 @@ export const useStreamChatTheme = () => {
5052
grey_gainsboro: '#DBDBDB',
5153
grey_whisper: '#ECEBEB',
5254
icon_background: '#FFFFFF',
55+
light_blue: '#E0F0FF',
56+
light_gray: '#E9EAED',
5357
modal_shadow: '#00000099', // 99 = 60% opacity; x=0, y= 1, radius=4
5458
overlay: '#00000099', // 99 = 60% opacity
5559
shadow_icon: '#00000040', // 40 = 25% opacity; x=0, y=0, radius=4

examples/SampleApp/src/hooks/useStreamChatTheme.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const getChatStyle = (colorScheme: ColorSchemeName): DeepPartial<Theme> => ({
2020
grey_gainsboro: '#2D2F2F',
2121
grey_whisper: '#1C1E22',
2222
icon_background: '#FFFFFF',
23+
light_blue: '#001333',
24+
light_gray: '#1C1E22',
2325
modal_shadow: '#000000',
2426
overlay: '#FFFFFFCC', // CC = 80% opacity
2527
shadow_icon: '#00000080', // 80 = 50% opacity
@@ -46,6 +48,8 @@ const getChatStyle = (colorScheme: ColorSchemeName): DeepPartial<Theme> => ({
4648
grey_gainsboro: '#DBDBDB',
4749
grey_whisper: '#ECEBEB',
4850
icon_background: '#FFFFFF',
51+
light_blue: '#E0F0FF',
52+
light_gray: '#E9EAED',
4953
modal_shadow: '#00000099', // 99 = 60% opacity; x=0, y= 1, radius=4
5054
overlay: '#00000099', // 99 = 60% opacity
5155
shadow_icon: '#00000040', // 40 = 25% opacity; x=0, y=0, radius=4

examples/TypeScriptMessaging/useStreamChatTheme.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ const getChatStyle = (colorScheme: string): DeepPartial<Theme> => ({
2525
grey_gainsboro: '#2D2F2F',
2626
grey_whisper: '#1C1E22',
2727
icon_background: '#FFFFFF',
28-
light_gray: '#272A30',
28+
light_blue: '#001333',
29+
light_gray: '#1C1E22',
2930
modal_shadow: '#000000',
3031
overlay: '#FFFFFFCC', // CC = 80% opacity
3132
shadow_icon: '#00000080', // 80 = 50% opacity
@@ -49,7 +50,8 @@ const getChatStyle = (colorScheme: string): DeepPartial<Theme> => ({
4950
grey_gainsboro: '#DBDBDB',
5051
grey_whisper: '#ECEBEB',
5152
icon_background: '#FFFFFF',
52-
light_gray: '#DBDDE1',
53+
light_blue: '#E0F0FF',
54+
light_gray: '#E9EAED',
5355
modal_shadow: '#00000099', // 99 = 60% opacity; x=0, y= 1, radius=4
5456
overlay: '#00000099', // 99 = 60% opacity
5557
shadow_icon: '#00000040', // 40 = 25% opacity; x=0, y=0, radius=4

package/src/components/Message/MessageSimple/MessageSimple.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const MessageSimpleWithContext = <
104104

105105
const {
106106
theme: {
107-
colors: { blue_alice, grey_gainsboro, transparent },
107+
colors: { blue_alice, grey_gainsboro, light_blue, light_gray, transparent },
108108
messageSimple: {
109109
container,
110110
content: {
@@ -160,7 +160,7 @@ const MessageSimpleWithContext = <
160160
}
161161
}
162162

163-
let backgroundColor = senderMessageBackgroundColor;
163+
let backgroundColor = senderMessageBackgroundColor ?? light_blue;
164164
if (onlyEmojis && !message.quoted_message) {
165165
backgroundColor = transparent;
166166
} else if (otherAttachments.length) {
@@ -170,7 +170,7 @@ const MessageSimpleWithContext = <
170170
backgroundColor = blue_alice;
171171
}
172172
} else if (isMessageReceivedOrErrorType) {
173-
backgroundColor = receiverMessageBackgroundColor;
173+
backgroundColor = receiverMessageBackgroundColor ?? light_gray;
174174
}
175175

176176
const repliesCurveColor = isMessageReceivedOrErrorType ? grey_gainsboro : backgroundColor;

package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ exports[`Thread should match thread snapshot 1`] = `
440440
"borderWidth": 1,
441441
},
442442
{
443-
"backgroundColor": "#DBDBDB",
443+
"backgroundColor": "#E9EAED",
444444
"borderBottomLeftRadius": 0,
445445
"borderBottomRightRadius": 16,
446446
"borderColor": "#ECEBEB",
@@ -788,7 +788,7 @@ exports[`Thread should match thread snapshot 1`] = `
788788
"borderWidth": 1,
789789
},
790790
{
791-
"backgroundColor": "#DBDBDB",
791+
"backgroundColor": "#E9EAED",
792792
"borderBottomLeftRadius": 0,
793793
"borderBottomRightRadius": 16,
794794
"borderColor": "#ECEBEB",
@@ -1136,7 +1136,7 @@ exports[`Thread should match thread snapshot 1`] = `
11361136
"borderWidth": 1,
11371137
},
11381138
{
1139-
"backgroundColor": "#DBDBDB",
1139+
"backgroundColor": "#E9EAED",
11401140
"borderBottomLeftRadius": 0,
11411141
"borderBottomRightRadius": 16,
11421142
"borderColor": "#ECEBEB",
@@ -1518,7 +1518,7 @@ exports[`Thread should match thread snapshot 1`] = `
15181518
"borderWidth": 1,
15191519
},
15201520
{
1521-
"backgroundColor": "#DBDBDB",
1521+
"backgroundColor": "#E9EAED",
15221522
"borderBottomLeftRadius": 0,
15231523
"borderBottomRightRadius": 16,
15241524
"borderColor": "#ECEBEB",

package/src/contexts/themeContext/utils/theme.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const Colors = {
2222
icon_background: '#FFFFFF',
2323
label_bg_transparent: '#00000033', // 33 = 20% opacity
2424
light_blue: '#E0F0FF',
25-
light_gray: '#DBDDE1',
25+
light_gray: '#E9EAED',
2626
modal_shadow: '#00000099', // 99 = 60% opacity; x=0, y= 1, radius=4
2727
overlay: '#000000CC', // CC = 80% opacity
2828
shadow_icon: '#00000040', // 40 = 25% opacity; x=0, y=0, radius=4
@@ -1152,10 +1152,8 @@ export const defaultTheme: Theme = {
11521152
metaText: {
11531153
fontSize: 12,
11541154
},
1155-
receiverMessageBackgroundColor: Colors.grey_gainsboro,
11561155
replyBorder: {},
11571156
replyContainer: {},
1158-
senderMessageBackgroundColor: Colors.light_blue,
11591157
textContainer: {
11601158
onlyEmojiMarkdown: { text: { fontSize: 50 } },
11611159
},

0 commit comments

Comments
 (0)