@@ -92,37 +92,37 @@ type MatrixRoomInfo = Arc<(MatrixRoom, Option<Tags>)>;
9292const MEMBER_FETCH_DEBOUNCE : Duration = Duration :: from_secs ( 5 ) ;
9393
9494#[ inline]
95- fn bold_style ( ) -> Style {
96- Style :: default ( ) . add_modifier ( StyleModifier :: BOLD )
95+ fn bold_style ( style : Style ) -> Style {
96+ style . add_modifier ( StyleModifier :: BOLD )
9797}
9898
9999#[ inline]
100- fn bold_span ( s : & str ) -> Span {
101- Span :: styled ( s, bold_style ( ) )
100+ fn bold_span ( s : & str , style : Style ) -> Span {
101+ Span :: styled ( s, bold_style ( style ) )
102102}
103103
104104#[ inline]
105- fn bold_spans ( s : & str ) -> Line {
106- bold_span ( s) . into ( )
105+ fn bold_spans ( s : & str , style : Style ) -> Line {
106+ bold_span ( s, style ) . into ( )
107107}
108108
109109#[ inline]
110- fn selected_style ( selected : bool ) -> Style {
110+ fn selected_style ( selected : bool , style : Style ) -> Style {
111111 if selected {
112- Style :: default ( ) . add_modifier ( StyleModifier :: REVERSED )
112+ style . add_modifier ( StyleModifier :: REVERSED )
113113 } else {
114- Style :: default ( )
114+ style
115115 }
116116}
117117
118118#[ inline]
119- fn selected_span ( s : & str , selected : bool ) -> Span {
120- Span :: styled ( s, selected_style ( selected) )
119+ fn selected_span ( s : & str , selected : bool , style : Style ) -> Span {
120+ Span :: styled ( s, selected_style ( selected, style ) )
121121}
122122
123123#[ inline]
124- fn selected_text ( s : & str , selected : bool ) -> Text {
125- Text :: from ( selected_span ( s, selected) )
124+ fn selected_text ( s : & str , selected : bool , style : Style ) -> Text {
125+ Text :: from ( selected_span ( s, selected, style ) )
126126}
127127
128128fn name_and_labels ( name : & str , unread : bool , style : Style ) -> ( Span < ' _ > , Vec < Vec < Span < ' _ > > > ) {
@@ -744,14 +744,15 @@ impl Window<IambInfo> for IambWindow {
744744 }
745745
746746 fn get_tab_title ( & self , store : & mut ProgramStore ) -> Line {
747+ let style = Default :: default ( ) ;
747748 match self {
748- IambWindow :: DirectList ( _) => bold_spans ( "Direct Messages" ) ,
749- IambWindow :: RoomList ( _) => bold_spans ( "Rooms" ) ,
750- IambWindow :: SpaceList ( _) => bold_spans ( "Spaces" ) ,
751- IambWindow :: VerifyList ( _) => bold_spans ( "Verifications" ) ,
752- IambWindow :: Welcome ( _) => bold_spans ( "Welcome to iamb" ) ,
753- IambWindow :: ChatList ( _) => bold_spans ( "DMs & Rooms" ) ,
754- IambWindow :: UnreadList ( _) => bold_spans ( "Unread Messages" ) ,
749+ IambWindow :: DirectList ( _) => bold_spans ( "Direct Messages" , style ) ,
750+ IambWindow :: RoomList ( _) => bold_spans ( "Rooms" , style ) ,
751+ IambWindow :: SpaceList ( _) => bold_spans ( "Spaces" , style ) ,
752+ IambWindow :: VerifyList ( _) => bold_spans ( "Verifications" , style ) ,
753+ IambWindow :: Welcome ( _) => bold_spans ( "Welcome to iamb" , style ) ,
754+ IambWindow :: ChatList ( _) => bold_spans ( "DMs & Rooms" , style ) ,
755+ IambWindow :: UnreadList ( _) => bold_spans ( "Unread Messages" , style ) ,
755756
756757 IambWindow :: Room ( w) => {
757758 let title = store. application . get_room_title ( w. id ( ) ) ;
@@ -762,8 +763,8 @@ impl Window<IambInfo> for IambWindow {
762763 let title = store. application . get_room_title ( room_id. as_ref ( ) ) ;
763764 let n = state. len ( ) ;
764765 let v = vec ! [
765- bold_span( "Room Members " ) ,
766- Span :: styled( format!( "({n}): " ) , bold_style( ) ) ,
766+ bold_span( "Room Members " , style ) ,
767+ Span :: styled( format!( "({n}): " ) , bold_style( style ) ) ,
767768 title. into( ) ,
768769 ] ;
769770 Line :: from ( v)
@@ -772,22 +773,23 @@ impl Window<IambInfo> for IambWindow {
772773 }
773774
774775 fn get_win_title ( & self , store : & mut ProgramStore ) -> Line {
776+ let style = store. application . settings . tunables . colors . window_title ;
775777 match self {
776- IambWindow :: DirectList ( _) => bold_spans ( "Direct Messages" ) ,
777- IambWindow :: RoomList ( _) => bold_spans ( "Rooms" ) ,
778- IambWindow :: SpaceList ( _) => bold_spans ( "Spaces" ) ,
779- IambWindow :: VerifyList ( _) => bold_spans ( "Verifications" ) ,
780- IambWindow :: Welcome ( _) => bold_spans ( "Welcome to iamb" ) ,
781- IambWindow :: ChatList ( _) => bold_spans ( "DMs & Rooms" ) ,
782- IambWindow :: UnreadList ( _) => bold_spans ( "Unread Messages" ) ,
778+ IambWindow :: DirectList ( _) => bold_spans ( "Direct Messages" , style ) ,
779+ IambWindow :: RoomList ( _) => bold_spans ( "Rooms" , style ) ,
780+ IambWindow :: SpaceList ( _) => bold_spans ( "Spaces" , style ) ,
781+ IambWindow :: VerifyList ( _) => bold_spans ( "Verifications" , style ) ,
782+ IambWindow :: Welcome ( _) => bold_spans ( "Welcome to iamb" , style ) ,
783+ IambWindow :: ChatList ( _) => bold_spans ( "DMs & Rooms" , style ) ,
784+ IambWindow :: UnreadList ( _) => bold_spans ( "Unread Messages" , style ) ,
783785
784786 IambWindow :: Room ( w) => w. get_title ( store) ,
785787 IambWindow :: MemberList ( state, room_id, _) => {
786788 let title = store. application . get_room_title ( room_id. as_ref ( ) ) ;
787789 let n = state. len ( ) ;
788790 let v = vec ! [
789- bold_span( "Room Members " ) ,
790- Span :: styled( format!( "({n}): " ) , bold_style( ) ) ,
791+ bold_span( "Room Members " , style ) ,
792+ Span :: styled( format!( "({n}): " ) , bold_style( style ) ) ,
791793 title. into( ) ,
792794 ] ;
793795 Line :: from ( v)
@@ -959,9 +961,19 @@ impl Display for GenericChatItem {
959961}
960962
961963impl ListItem < IambInfo > for GenericChatItem {
962- fn show ( & self , selected : bool , _: & ViewportContext < ListCursor > , _: & mut ProgramStore ) -> Text {
964+ fn show (
965+ & self ,
966+ selected : bool ,
967+ _: & ViewportContext < ListCursor > ,
968+ store : & mut ProgramStore ,
969+ ) -> Text {
963970 let unread = self . unread . is_unread ( ) ;
964- let style = selected_style ( selected) ;
971+ let style = if unread {
972+ store. application . settings . tunables . colors . room_list_unread
973+ } else {
974+ store. application . settings . tunables . colors . room_list
975+ } ;
976+ let style = selected_style ( selected, style) ;
965977 let ( name, mut labels) = name_and_labels ( & self . name , unread, style) ;
966978 let mut spans = vec ! [ name] ;
967979
@@ -1073,9 +1085,19 @@ impl Display for RoomItem {
10731085}
10741086
10751087impl ListItem < IambInfo > for RoomItem {
1076- fn show ( & self , selected : bool , _: & ViewportContext < ListCursor > , _: & mut ProgramStore ) -> Text {
1088+ fn show (
1089+ & self ,
1090+ selected : bool ,
1091+ _: & ViewportContext < ListCursor > ,
1092+ store : & mut ProgramStore ,
1093+ ) -> Text {
10771094 let unread = self . unread . is_unread ( ) ;
1078- let style = selected_style ( selected) ;
1095+ let style = if unread {
1096+ store. application . settings . tunables . colors . room_list_unread
1097+ } else {
1098+ store. application . settings . tunables . colors . room_list
1099+ } ;
1100+ let style = selected_style ( selected, style) ;
10791101 let ( name, mut labels) = name_and_labels ( & self . name , unread, style) ;
10801102 let mut spans = vec ! [ name] ;
10811103
@@ -1177,9 +1199,19 @@ impl Display for DirectItem {
11771199}
11781200
11791201impl ListItem < IambInfo > for DirectItem {
1180- fn show ( & self , selected : bool , _: & ViewportContext < ListCursor > , _: & mut ProgramStore ) -> Text {
1202+ fn show (
1203+ & self ,
1204+ selected : bool ,
1205+ _: & ViewportContext < ListCursor > ,
1206+ store : & mut ProgramStore ,
1207+ ) -> Text {
11811208 let unread = self . unread . is_unread ( ) ;
1182- let style = selected_style ( selected) ;
1209+ let style = if unread {
1210+ store. application . settings . tunables . colors . room_list_unread
1211+ } else {
1212+ store. application . settings . tunables . colors . room_list
1213+ } ;
1214+ let style = selected_style ( selected, style) ;
11831215 let ( name, mut labels) = name_and_labels ( & self . name , unread, style) ;
11841216 let mut spans = vec ! [ name] ;
11851217
@@ -1280,8 +1312,17 @@ impl Display for SpaceItem {
12801312}
12811313
12821314impl ListItem < IambInfo > for SpaceItem {
1283- fn show ( & self , selected : bool , _: & ViewportContext < ListCursor > , _: & mut ProgramStore ) -> Text {
1284- selected_text ( self . name . as_str ( ) , selected)
1315+ fn show (
1316+ & self ,
1317+ selected : bool ,
1318+ _: & ViewportContext < ListCursor > ,
1319+ store : & mut ProgramStore ,
1320+ ) -> Text {
1321+ selected_text (
1322+ self . name . as_str ( ) ,
1323+ selected,
1324+ store. application . settings . tunables . colors . room_list ,
1325+ )
12851326 }
12861327
12871328 fn get_word ( & self ) -> Option < String > {
@@ -1415,7 +1456,7 @@ impl ListItem<IambInfo> for VerifyItem {
14151456 let mut lines = vec ! [ ] ;
14161457
14171458 let bold = Style :: default ( ) . add_modifier ( StyleModifier :: BOLD ) ;
1418- let item = Span :: styled ( self . show_item ( ) , selected_style ( selected) ) ;
1459+ let item = Span :: styled ( self . show_item ( ) , selected_style ( selected, Default :: default ( ) ) ) ;
14191460 lines. push ( Line :: from ( item) ) ;
14201461
14211462 if self . sasv1 . is_done ( ) {
0 commit comments