From a892d034f1e659ab49e6623a418a5dd6933854cf Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 26 Jun 2024 16:03:25 +0200 Subject: [PATCH] Adaptation des couleurs des pills lors des mentions --- Riot/Modules/MatrixKit/Views/MXKMessageTextView.m | 2 +- Riot/Modules/Pills/PillAttachmentView.swift | 9 +++++++-- Riot/Utils/EventFormatter.m | 4 +++- changelog.d/1067.change | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 changelog.d/1067.change diff --git a/Riot/Modules/MatrixKit/Views/MXKMessageTextView.m b/Riot/Modules/MatrixKit/Views/MXKMessageTextView.m index 776b68bbe..5059d9a63 100644 --- a/Riot/Modules/MatrixKit/Views/MXKMessageTextView.m +++ b/Riot/Modules/MatrixKit/Views/MXKMessageTextView.m @@ -95,7 +95,7 @@ - (void)setAttributedText:(NSAttributedString *)attributedText [self flushPills]; } - // Tchap: set text type to prefered font to rerspect user text size, but only if timeline style is set to bubble. + // Tchap: set text type to prefered font to respect user text size, but only if timeline style is set to bubble. if (RiotSettings.shared.roomTimelineStyleIdentifier == RoomTimelineStyleIdentifierBubble ) { attributedText = [self respectPreferredFontForAttributedString:attributedText]; } diff --git a/Riot/Modules/Pills/PillAttachmentView.swift b/Riot/Modules/Pills/PillAttachmentView.swift index 575808bd7..db9051966 100644 --- a/Riot/Modules/Pills/PillAttachmentView.swift +++ b/Riot/Modules/Pills/PillAttachmentView.swift @@ -68,7 +68,10 @@ class PillAttachmentView: UIView { let label = UILabel(frame: .zero) label.text = string label.font = pillData.font - label.textColor = pillData.isHighlighted ? theme.baseTextPrimaryColor : theme.textPrimaryColor + // Tchap: set highlighted pill text content light enough to be readable in light and dark themes. + // Only `baseTextPrimaryColor` is light enough in both themes. +// label.textColor = pillData.isHighlighted ? theme.baseTextPrimaryColor : theme.textPrimaryColor + label.textColor = pillData.isHighlighted ? theme.baseIconPrimaryColor : theme.textPrimaryColor label.translatesAutoresizingMaskIntoConstraints = false stack.addArrangedSubview(label) @@ -154,7 +157,9 @@ class PillAttachmentView: UIView { pillBackgroundView.vc_addSubViewMatchingParent(stack, withInsets: UIEdgeInsets(top: sizes.verticalMargin, left: leadingStackMargin, bottom: -sizes.verticalMargin, right: -sizes.horizontalMargin)) - pillBackgroundView.backgroundColor = pillData.isHighlighted ? theme.colors.alert : theme.colors.quinaryContent + // Tchap: set highlighted pill background color to accent color (not red) +// pillBackgroundView.backgroundColor = pillData.isHighlighted ? theme.colors.alert : theme.colors.quinaryContent + pillBackgroundView.backgroundColor = pillData.isHighlighted ? theme.colors.accent : theme.colors.quinaryContent pillBackgroundView.layer.cornerRadius = sizes.pillBackgroundHeight / 2.0 self.addSubview(pillBackgroundView) diff --git a/Riot/Utils/EventFormatter.m b/Riot/Utils/EventFormatter.m index 17ab314fd..f9716430c 100644 --- a/Riot/Utils/EventFormatter.m +++ b/Riot/Utils/EventFormatter.m @@ -504,7 +504,9 @@ - (instancetype)initWithMatrixSession:(MXSession *)matrixSession self.defaultTextColor = ThemeService.shared.theme.textPrimaryColor; self.subTitleTextColor = ThemeService.shared.theme.textSecondaryColor; self.prefixTextColor = ThemeService.shared.theme.textSecondaryColor; - self.bingTextColor = ThemeService.shared.theme.noticeColor; + // Tchap: Don't set text color to red/notice when a user is targeted. +// self.bingTextColor = ThemeService.shared.theme.noticeColor; + self.bingTextColor = ThemeService.shared.theme.textPrimaryColor; self.encryptingTextColor = ThemeService.shared.theme.textPrimaryColor; self.sendingTextColor = ThemeService.shared.theme.textPrimaryColor; self.linksColor = ThemeService.shared.theme.colors.links; diff --git a/changelog.d/1067.change b/changelog.d/1067.change new file mode 100644 index 000000000..9f3ec57bc --- /dev/null +++ b/changelog.d/1067.change @@ -0,0 +1 @@ +Adaptation des couleurs des pills lors des mentions \ No newline at end of file