Skip to content

Commit

Permalink
Adaptation des couleurs des pills lors des mentions
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Buquet committed Jun 26, 2024
1 parent c8da058 commit a892d03
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Riot/Modules/MatrixKit/Views/MXKMessageTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
9 changes: 7 additions & 2 deletions Riot/Modules/Pills/PillAttachmentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion Riot/Utils/EventFormatter.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions changelog.d/1067.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adaptation des couleurs des pills lors des mentions

0 comments on commit a892d03

Please sign in to comment.