@@ -553,11 +553,19 @@ class StreamMessageRecipientHeader extends StatelessWidget {
553
553
554
554
final topic = message.subject;
555
555
final subscription = store.subscriptions[message.streamId];
556
- final streamColor = Color (subscription? .color ?? 0x00c2c2c2 );
557
- final contrastingColor =
558
- ThemeData .estimateBrightnessForColor (streamColor) == Brightness .dark
559
- ? Colors .white
560
- : Colors .black;
556
+ final Color backgroundColor;
557
+ final Color contrastingColor;
558
+ if (subscription != null ) {
559
+ final swatch = subscription.colorSwatch ();
560
+ backgroundColor = swatch.barBackground;
561
+ contrastingColor =
562
+ (ThemeData .estimateBrightnessForColor (swatch.barBackground) == Brightness .dark)
563
+ ? Colors .white
564
+ : Colors .black;
565
+ } else {
566
+ backgroundColor = _kFallbackStreamColor;
567
+ contrastingColor = Colors .black;
568
+ }
561
569
final textStyle = TextStyle (
562
570
color: contrastingColor,
563
571
);
@@ -592,7 +600,7 @@ class StreamMessageRecipientHeader extends StatelessWidget {
592
600
MessageListPage .buildRoute (context: context,
593
601
narrow: TopicNarrow .ofMessage (message))),
594
602
child: ColoredBox (
595
- color: _kStreamMessageBorderColor ,
603
+ color: backgroundColor ,
596
604
child: Row (mainAxisAlignment: MainAxisAlignment .start, children: [
597
605
// TODO(#282): Long stream name will break layout; find a fix.
598
606
streamWidget,
@@ -608,13 +616,11 @@ class StreamMessageRecipientHeader extends StatelessWidget {
608
616
// TODO topic links?
609
617
// Then web also has edit/resolve/mute buttons. Skip those for mobile.
610
618
RecipientHeaderDate (message: message,
611
- color: _kRecipientHeaderDateColor ),
619
+ color: contrastingColor. withOpacity ( 0.4 ) ),
612
620
])));
613
621
}
614
622
}
615
623
616
- final _kStreamMessageBorderColor = const HSLColor .fromAHSL (1 , 0 , 0 , 0.88 ).toColor ();
617
-
618
624
class DmRecipientHeader extends StatelessWidget {
619
625
const DmRecipientHeader ({super .key, required this .message});
620
626
0 commit comments