From dd26555c22573233b59254a47383c59a198876ba Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 24 Mar 2026 16:31:15 +0100 Subject: [PATCH] Update colors of permalinks. --- .../libraries/textcomposer/mentions/MentionSpan.kt | 4 ++-- .../textcomposer/mentions/MentionSpanTheme.kt | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/mentions/MentionSpan.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/mentions/MentionSpan.kt index 2531a605b9..b0f973b6b9 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/mentions/MentionSpan.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/mentions/MentionSpan.kt @@ -55,14 +55,14 @@ class MentionSpan( backgroundColor = when (type) { is MentionType.User -> if (isCurrentUser) mentionSpanTheme.currentUserBackgroundColor else mentionSpanTheme.otherBackgroundColor - is MentionType.Everyone -> mentionSpanTheme.currentUserBackgroundColor + is MentionType.Everyone -> mentionSpanTheme.otherBackgroundColor is MentionType.Room -> mentionSpanTheme.otherBackgroundColor is MentionType.Message -> mentionSpanTheme.otherBackgroundColor } textColor = when (type) { is MentionType.User -> if (isCurrentUser) mentionSpanTheme.currentUserTextColor else mentionSpanTheme.otherTextColor - is MentionType.Everyone -> mentionSpanTheme.currentUserTextColor + is MentionType.Everyone -> mentionSpanTheme.otherTextColor is MentionType.Room -> mentionSpanTheme.otherTextColor is MentionType.Message -> mentionSpanTheme.otherTextColor } diff --git a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/mentions/MentionSpanTheme.kt b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/mentions/MentionSpanTheme.kt index f64c8112d1..c2270e503d 100644 --- a/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/mentions/MentionSpanTheme.kt +++ b/libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/mentions/MentionSpanTheme.kt @@ -54,6 +54,7 @@ import kotlinx.collections.immutable.persistentListOf * To make this work, you need to: * 1. Call [MentionSpanTheme.updateStyles] so the colors and sizes are computed. * 2. Use either [MentionSpanTheme.updateMentionStyles] or [MentionSpan.updateTheme] to update the styles of the mention spans. + * https://www.figma.com/design/G1xy0HDZKJf5TCRFmKb5d5/Compound-Android-Components?node-id=3236-11203 */ @Stable @SingleIn(SessionScope::class) @@ -61,10 +62,14 @@ class MentionSpanTheme(val currentUserId: UserId) { @Inject constructor(matrixClient: MatrixClient) : this(matrixClient.sessionId) - internal var currentUserTextColor: Int = 0 + internal var currentUserTextColor: Int = Color.BLACK + private set internal var currentUserBackgroundColor: Int = Color.WHITE - internal var otherTextColor: Int = 0 + private set + internal var otherTextColor: Int = Color.BLACK + private set internal var otherBackgroundColor: Int = Color.WHITE + private set private val paddingValues = PaddingValues(start = 4.dp, end = 6.dp) internal val paddingValuesPx = mutableStateOf(0 to 0) @@ -78,8 +83,8 @@ class MentionSpanTheme(val currentUserId: UserId) { fun updateStyles() { currentUserTextColor = ElementTheme.colors.textBadgeAccent.toArgb() currentUserBackgroundColor = ElementTheme.colors.bgBadgeAccent.toArgb() - otherTextColor = ElementTheme.colors.textPrimary.toArgb() - otherBackgroundColor = ElementTheme.colors.bgBadgeDefault.toArgb() + otherTextColor = ElementTheme.colors.textOnSolidPrimary.toArgb() + otherBackgroundColor = ElementTheme.colors.bgBadgePrimary.toArgb() typeface.value = ElementTheme.typography.fontBodyLgMedium.rememberTypeface().value val density = LocalDensity.current