Change fun to val and extend SemanticColors

This commit is contained in:
Benoit Marty 2025-07-08 17:46:12 +02:00
parent d445e3695b
commit 0077d96138
2 changed files with 14 additions and 14 deletions

View file

@ -219,7 +219,7 @@ private fun NameAndTimestampRow(
style = ElementTheme.typography.fontBodyLgMedium, style = ElementTheme.typography.fontBodyLgMedium,
text = name ?: stringResource(id = CommonStrings.common_no_room_name), text = name ?: stringResource(id = CommonStrings.common_no_room_name),
fontStyle = FontStyle.Italic.takeIf { name == null }, fontStyle = FontStyle.Italic.takeIf { name == null },
color = ElementTheme.roomListRoomName(), color = ElementTheme.colors.roomListRoomName,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
) )
@ -230,7 +230,7 @@ private fun NameAndTimestampRow(
color = if (isHighlighted) { color = if (isHighlighted) {
ElementTheme.colors.unreadIndicator ElementTheme.colors.unreadIndicator
} else { } else {
ElementTheme.roomListRoomMessageDate() ElementTheme.colors.roomListRoomMessageDate
}, },
) )
} }
@ -253,7 +253,7 @@ private fun InviteSubtitle(
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
style = ElementTheme.typography.fontBodyMdRegular, style = ElementTheme.typography.fontBodyMdRegular,
color = ElementTheme.roomListRoomMessage(), color = ElementTheme.colors.roomListRoomMessage,
modifier = modifier, modifier = modifier,
) )
} }
@ -277,7 +277,7 @@ private fun MessagePreviewAndIndicatorRow(
Text( Text(
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
text = annotatedMessagePreview, text = annotatedMessagePreview,
color = ElementTheme.roomListRoomMessage(), color = ElementTheme.colors.roomListRoomMessage,
style = ElementTheme.typography.fontBodyMdRegular, style = ElementTheme.typography.fontBodyMdRegular,
minLines = 2, minLines = 2,
maxLines = 2, maxLines = 2,
@ -325,7 +325,7 @@ private fun InviteNameAndIndicatorRow(
style = ElementTheme.typography.fontBodyLgMedium, style = ElementTheme.typography.fontBodyLgMedium,
text = name ?: stringResource(id = CommonStrings.common_no_room_name), text = name ?: stringResource(id = CommonStrings.common_no_room_name),
fontStyle = FontStyle.Italic.takeIf { name == null }, fontStyle = FontStyle.Italic.takeIf { name == null },
color = ElementTheme.roomListRoomName(), color = ElementTheme.colors.roomListRoomName,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
) )

View file

@ -22,14 +22,14 @@ import kotlinx.collections.immutable.persistentMapOf
/** /**
* Room list. * Room list.
*/ */
@Composable val SemanticColors.roomListRoomName
fun ElementTheme.roomListRoomName() = colors.textPrimary get() = textPrimary
@Composable val SemanticColors.roomListRoomMessage
fun ElementTheme.roomListRoomMessage() = colors.textSecondary get() = textSecondary
@Composable val SemanticColors.roomListRoomMessageDate
fun ElementTheme.roomListRoomMessageDate() = colors.textSecondary get() = textSecondary
val SemanticColors.unreadIndicator val SemanticColors.unreadIndicator
get() = iconAccentTertiary get() = iconAccentTertiary
@ -81,9 +81,9 @@ internal fun ColorAliasesPreview() = ElementPreview {
backgroundColor = Color.Black, backgroundColor = Color.Black,
foregroundColor = Color.White, foregroundColor = Color.White,
colors = persistentMapOf( colors = persistentMapOf(
"roomListRoomName" to ElementTheme.roomListRoomName(), "roomListRoomName" to ElementTheme.colors.roomListRoomName,
"roomListRoomMessage" to ElementTheme.roomListRoomMessage(), "roomListRoomMessage" to ElementTheme.colors.roomListRoomMessage,
"roomListRoomMessageDate" to ElementTheme.roomListRoomMessageDate(), "roomListRoomMessageDate" to ElementTheme.colors.roomListRoomMessageDate,
"unreadIndicator" to ElementTheme.colors.unreadIndicator, "unreadIndicator" to ElementTheme.colors.unreadIndicator,
"placeholderBackground" to ElementTheme.colors.placeholderBackground, "placeholderBackground" to ElementTheme.colors.placeholderBackground,
"messageFromMeBackground" to ElementTheme.colors.messageFromMeBackground, "messageFromMeBackground" to ElementTheme.colors.messageFromMeBackground,