@@ -548,6 +548,13 @@ class StreamMessageRecipientHeader extends StatelessWidget {
548
548
549
549
final stream = store.streams[message.streamId];
550
550
final topic = message.subject;
551
+ final swatch = store.subscriptions[message.streamId]? .colorSwatch ()
552
+ ?? _kFallbackStreamColorSwatch;
553
+ final contrastingColor =
554
+ (ThemeData .estimateBrightnessForColor (swatch.barBackground) == Brightness .dark)
555
+ ? Colors .white
556
+ : Colors .black;
557
+ final textStyle = TextStyle (color: contrastingColor);
551
558
552
559
final streamWidget = (showStream)
553
560
? GestureDetector (
@@ -557,13 +564,14 @@ class StreamMessageRecipientHeader extends StatelessWidget {
557
564
child: Row (children: [
558
565
const SizedBox (width: 16 ),
559
566
// TODO globe/lock icons for web-public and private streams
560
- Text (stream? .name ?? message.displayRecipient), // TODO(log) if missing
567
+ Text (stream? .name ?? message.displayRecipient, // TODO(log) if missing
568
+ style: textStyle),
561
569
Padding (
562
570
// Figma has 5px horizontal padding around an 8px wide icon.
563
571
// Icon is 16px wide here so horizontal padding is 1px.
564
572
padding: const EdgeInsets .symmetric (horizontal: 1 ),
565
573
child: Icon (size: 16 ,
566
- color: const HSLColor . fromAHSL ( 0.60 , 0 , 0 , 0 ). toColor (),
574
+ color: contrastingColor. withAlpha ( 154 ), // 60%
567
575
ZulipIcons .chevron_right)),
568
576
]))
569
577
: const SizedBox (width: 16 );
@@ -573,7 +581,7 @@ class StreamMessageRecipientHeader extends StatelessWidget {
573
581
MessageListPage .buildRoute (context: context,
574
582
narrow: TopicNarrow .ofMessage (message))),
575
583
child: ColoredBox (
576
- color: _kStreamMessageBorderColor ,
584
+ color: swatch.barBackground ,
577
585
child: Row (mainAxisAlignment: MainAxisAlignment .start, children: [
578
586
// TODO(#282): Long stream name will break layout; find a fix.
579
587
streamWidget,
@@ -584,18 +592,17 @@ class StreamMessageRecipientHeader extends StatelessWidget {
584
592
child: Text (topic,
585
593
// TODO: Give a way to see the whole topic (maybe a
586
594
// long-press interaction?)
587
- overflow: TextOverflow .ellipsis))),
595
+ overflow: TextOverflow .ellipsis,
596
+ style: textStyle))),
588
597
// TODO topic links?
589
598
// Then web also has edit/resolve/mute buttons. Skip those for mobile.
590
599
RecipientHeaderDate (message: message,
591
- color: const HSLColor . fromAHSL ( 0.75 , 0 , 0 , 0.15 ). toColor ()),
600
+ color: contrastingColor. withAlpha ( 102 )), // 40%
592
601
const SizedBox (width: 16 ),
593
602
])));
594
603
}
595
604
}
596
605
597
- final _kStreamMessageBorderColor = const HSLColor .fromAHSL (1 , 0 , 0 , 0.88 ).toColor ();
598
-
599
606
class DmRecipientHeader extends StatelessWidget {
600
607
const DmRecipientHeader ({super .key, required this .message});
601
608
0 commit comments