@@ -36,6 +36,9 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
36
36
senderBotIcon: const HSLColor .fromAHSL (1 , 180 , 0.08 , 0.65 ).toColor (),
37
37
senderName: const HSLColor .fromAHSL (1 , 0 , 0 , 0.2 ).toColor (),
38
38
streamMessageBgDefault: Colors .white,
39
+ // Background color for DM messages in light theme.
40
+ // Matches web app's --color-background-private-message-content: hsl(45deg 20% 96%)
41
+ dmMessageBgDefault: const HSLColor .fromAHSL (1 , 45 , 0.20 , 0.96 ).toColor (),
39
42
streamRecipientHeaderChevronRight: Colors .black.withValues (alpha: 0.3 ),
40
43
41
44
// From the Figma mockup at:
@@ -61,6 +64,9 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
61
64
senderBotIcon: const HSLColor .fromAHSL (1 , 180 , 0.05 , 0.5 ).toColor (),
62
65
senderName: const HSLColor .fromAHSL (0.85 , 0 , 0 , 1 ).toColor (),
63
66
streamMessageBgDefault: const HSLColor .fromAHSL (1 , 0 , 0 , 0.15 ).toColor (),
67
+ // Background color for DM messages in dark theme.
68
+ // Matches web app's --color-background-private-message-content: hsl(46deg 7% 16%)
69
+ dmMessageBgDefault: const HSLColor .fromAHSL (1 , 46 , 0.07 , 0.16 ).toColor (),
64
70
streamRecipientHeaderChevronRight: Colors .white.withValues (alpha: 0.3 ),
65
71
66
72
// 0.75 opacity from here:
@@ -85,6 +91,7 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
85
91
required this .senderBotIcon,
86
92
required this .senderName,
87
93
required this .streamMessageBgDefault,
94
+ required this .dmMessageBgDefault,
88
95
required this .streamRecipientHeaderChevronRight,
89
96
required this .unreadMarker,
90
97
required this .unreadMarkerGap,
@@ -109,6 +116,7 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
109
116
final Color senderBotIcon;
110
117
final Color senderName;
111
118
final Color streamMessageBgDefault;
119
+ final Color dmMessageBgDefault;
112
120
final Color streamRecipientHeaderChevronRight;
113
121
final Color unreadMarker;
114
122
final Color unreadMarkerGap;
@@ -124,6 +132,7 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
124
132
Color ? senderBotIcon,
125
133
Color ? senderName,
126
134
Color ? streamMessageBgDefault,
135
+ Color ? dmMessageBgDefault,
127
136
Color ? streamRecipientHeaderChevronRight,
128
137
Color ? unreadMarker,
129
138
Color ? unreadMarkerGap,
@@ -138,6 +147,7 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
138
147
senderBotIcon: senderBotIcon ?? this .senderBotIcon,
139
148
senderName: senderName ?? this .senderName,
140
149
streamMessageBgDefault: streamMessageBgDefault ?? this .streamMessageBgDefault,
150
+ dmMessageBgDefault: dmMessageBgDefault ?? this .dmMessageBgDefault,
141
151
streamRecipientHeaderChevronRight: streamRecipientHeaderChevronRight ?? this .streamRecipientHeaderChevronRight,
142
152
unreadMarker: unreadMarker ?? this .unreadMarker,
143
153
unreadMarkerGap: unreadMarkerGap ?? this .unreadMarkerGap,
@@ -153,12 +163,13 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
153
163
return MessageListTheme ._(
154
164
dateSeparator: Color .lerp (dateSeparator, other.dateSeparator, t)! ,
155
165
dateSeparatorText: Color .lerp (dateSeparatorText, other.dateSeparatorText, t)! ,
156
- dmRecipientHeaderBg: Color .lerp (streamMessageBgDefault , other.dmRecipientHeaderBg, t)! ,
166
+ dmRecipientHeaderBg: Color .lerp (dmRecipientHeaderBg , other.dmRecipientHeaderBg, t)! ,
157
167
messageTimestamp: Color .lerp (messageTimestamp, other.messageTimestamp, t)! ,
158
168
recipientHeaderText: Color .lerp (recipientHeaderText, other.recipientHeaderText, t)! ,
159
169
senderBotIcon: Color .lerp (senderBotIcon, other.senderBotIcon, t)! ,
160
170
senderName: Color .lerp (senderName, other.senderName, t)! ,
161
171
streamMessageBgDefault: Color .lerp (streamMessageBgDefault, other.streamMessageBgDefault, t)! ,
172
+ dmMessageBgDefault: Color .lerp (dmMessageBgDefault, other.dmMessageBgDefault, t)! ,
162
173
streamRecipientHeaderChevronRight: Color .lerp (streamRecipientHeaderChevronRight, other.streamRecipientHeaderChevronRight, t)! ,
163
174
unreadMarker: Color .lerp (unreadMarker, other.unreadMarker, t)! ,
164
175
unreadMarkerGap: Color .lerp (unreadMarkerGap, other.unreadMarkerGap, t)! ,
@@ -931,8 +942,14 @@ class DateSeparator extends StatelessWidget {
931
942
932
943
final line = BorderSide (width: 0 , color: messageListTheme.dateSeparator);
933
944
934
- // TODO(#681) use different color for DM messages
935
- return ColoredBox (color: messageListTheme.streamMessageBgDefault,
945
+ // Choose background color based on message type to maintain visual consistency
946
+ // DM messages and their date separators share the same distinct background
947
+ final backgroundColor = switch (message) {
948
+ StreamMessage () => messageListTheme.streamMessageBgDefault,
949
+ DmMessage () => messageListTheme.dmMessageBgDefault,
950
+ };
951
+
952
+ return ColoredBox (color: backgroundColor,
936
953
child: Padding (
937
954
padding: const EdgeInsets .symmetric (vertical: 8 , horizontal: 2 ),
938
955
child: Row (children: [
@@ -973,13 +990,20 @@ class MessageItem extends StatelessWidget {
973
990
Widget build (BuildContext context) {
974
991
final message = item.message;
975
992
final messageListTheme = MessageListTheme .of (context);
993
+
994
+ // Choose background color based on message type to maintain consistency
995
+ final backgroundColor = switch (message) {
996
+ StreamMessage () => messageListTheme.streamMessageBgDefault,
997
+ DmMessage () => messageListTheme.dmMessageBgDefault,
998
+ };
999
+
976
1000
return StickyHeaderItem (
977
1001
allowOverflow: ! item.isLastInBlock,
978
1002
header: header,
979
1003
child: _UnreadMarker (
980
1004
isRead: message.flags.contains (MessageFlag .read),
981
1005
child: ColoredBox (
982
- color: messageListTheme.streamMessageBgDefault ,
1006
+ color: backgroundColor ,
983
1007
child: Column (children: [
984
1008
MessageWithPossibleSender (item: item),
985
1009
if (trailingWhitespace != null && item.isLastInBlock) SizedBox (height: trailingWhitespace! ),
0 commit comments