From 484ecb5f6ce4d95c8a370804032b014d82c8e1d1 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 31 Jan 2025 17:10:14 +0100 Subject: [PATCH] Color aliases now use ElementTheme --- .../roomlist/impl/components/RoomSummaryRow.kt | 11 +++++------ .../libraries/designsystem/theme/ColorAliases.kt | 13 ++++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt index 05ff1042e5..0fbd4d38fe 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt @@ -24,7 +24,6 @@ import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width -import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ripple import androidx.compose.runtime.Composable import androidx.compose.runtime.remember @@ -212,7 +211,7 @@ private fun NameAndTimestampRow( style = ElementTheme.typography.fontBodyLgMedium, text = name ?: stringResource(id = CommonStrings.common_no_room_name), fontStyle = FontStyle.Italic.takeIf { name == null }, - color = MaterialTheme.roomListRoomName(), + color = ElementTheme.roomListRoomName(), maxLines = 1, overflow = TextOverflow.Ellipsis ) @@ -223,7 +222,7 @@ private fun NameAndTimestampRow( color = if (isHighlighted) { ElementTheme.colors.unreadIndicator } else { - MaterialTheme.roomListRoomMessageDate() + ElementTheme.roomListRoomMessageDate() }, ) } @@ -247,7 +246,7 @@ private fun InviteSubtitle( maxLines = 1, overflow = TextOverflow.Ellipsis, style = ElementTheme.typography.fontBodyMdRegular, - color = MaterialTheme.roomListRoomMessage(), + color = ElementTheme.roomListRoomMessage(), modifier = modifier, ) } @@ -268,7 +267,7 @@ private fun LastMessageAndIndicatorRow( Text( modifier = Modifier.weight(1f), text = attributedLastMessage, - color = MaterialTheme.roomListRoomMessage(), + color = ElementTheme.roomListRoomMessage(), style = ElementTheme.typography.fontBodyMdRegular, minLines = 2, maxLines = 2, @@ -315,7 +314,7 @@ private fun InviteNameAndIndicatorRow( style = ElementTheme.typography.fontBodyLgMedium, text = name ?: stringResource(id = CommonStrings.common_no_room_name), fontStyle = FontStyle.Italic.takeIf { name == null }, - color = MaterialTheme.roomListRoomName(), + color = ElementTheme.roomListRoomName(), maxLines = 1, overflow = TextOverflow.Ellipsis ) diff --git a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/ColorAliases.kt b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/ColorAliases.kt index 29d3633cc0..77ac8d6dd6 100644 --- a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/ColorAliases.kt +++ b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/ColorAliases.kt @@ -7,7 +7,6 @@ package io.element.android.libraries.designsystem.theme -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color import io.element.android.compound.annotations.CoreColorToken @@ -24,13 +23,13 @@ import kotlinx.collections.immutable.persistentMapOf * Room list. */ @Composable -fun MaterialTheme.roomListRoomName() = colorScheme.primary +fun ElementTheme.roomListRoomName() = colors.textPrimary @Composable -fun MaterialTheme.roomListRoomMessage() = colorScheme.secondary +fun ElementTheme.roomListRoomMessage() = colors.textSecondary @Composable -fun MaterialTheme.roomListRoomMessageDate() = colorScheme.secondary +fun ElementTheme.roomListRoomMessageDate() = colors.textSecondary val SemanticColors.unreadIndicator get() = iconAccentTertiary @@ -181,9 +180,9 @@ internal fun ColorAliasesPreview() = ElementPreview { backgroundColor = Color.Black, foregroundColor = Color.White, colors = persistentMapOf( - "roomListRoomName" to MaterialTheme.roomListRoomName(), - "roomListRoomMessage" to MaterialTheme.roomListRoomMessage(), - "roomListRoomMessageDate" to MaterialTheme.roomListRoomMessageDate(), + "roomListRoomName" to ElementTheme.roomListRoomName(), + "roomListRoomMessage" to ElementTheme.roomListRoomMessage(), + "roomListRoomMessageDate" to ElementTheme.roomListRoomMessageDate(), "unreadIndicator" to ElementTheme.colors.unreadIndicator, "placeholderBackground" to ElementTheme.colors.placeholderBackground, "messageFromMeBackground" to ElementTheme.colors.messageFromMeBackground,