Color aliases now use ElementTheme

This commit is contained in:
Benoit Marty 2025-01-31 17:10:14 +01:00
parent 468ef0f7fc
commit 484ecb5f6c
2 changed files with 11 additions and 13 deletions

View file

@ -24,7 +24,6 @@ import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.width
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ripple import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
@ -212,7 +211,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 = MaterialTheme.roomListRoomName(), color = ElementTheme.roomListRoomName(),
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
) )
@ -223,7 +222,7 @@ private fun NameAndTimestampRow(
color = if (isHighlighted) { color = if (isHighlighted) {
ElementTheme.colors.unreadIndicator ElementTheme.colors.unreadIndicator
} else { } else {
MaterialTheme.roomListRoomMessageDate() ElementTheme.roomListRoomMessageDate()
}, },
) )
} }
@ -247,7 +246,7 @@ private fun InviteSubtitle(
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
style = ElementTheme.typography.fontBodyMdRegular, style = ElementTheme.typography.fontBodyMdRegular,
color = MaterialTheme.roomListRoomMessage(), color = ElementTheme.roomListRoomMessage(),
modifier = modifier, modifier = modifier,
) )
} }
@ -268,7 +267,7 @@ private fun LastMessageAndIndicatorRow(
Text( Text(
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
text = attributedLastMessage, text = attributedLastMessage,
color = MaterialTheme.roomListRoomMessage(), color = ElementTheme.roomListRoomMessage(),
style = ElementTheme.typography.fontBodyMdRegular, style = ElementTheme.typography.fontBodyMdRegular,
minLines = 2, minLines = 2,
maxLines = 2, maxLines = 2,
@ -315,7 +314,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 = MaterialTheme.roomListRoomName(), color = ElementTheme.roomListRoomName(),
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
) )

View file

@ -7,7 +7,6 @@
package io.element.android.libraries.designsystem.theme package io.element.android.libraries.designsystem.theme
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import io.element.android.compound.annotations.CoreColorToken import io.element.android.compound.annotations.CoreColorToken
@ -24,13 +23,13 @@ import kotlinx.collections.immutable.persistentMapOf
* Room list. * Room list.
*/ */
@Composable @Composable
fun MaterialTheme.roomListRoomName() = colorScheme.primary fun ElementTheme.roomListRoomName() = colors.textPrimary
@Composable @Composable
fun MaterialTheme.roomListRoomMessage() = colorScheme.secondary fun ElementTheme.roomListRoomMessage() = colors.textSecondary
@Composable @Composable
fun MaterialTheme.roomListRoomMessageDate() = colorScheme.secondary fun ElementTheme.roomListRoomMessageDate() = colors.textSecondary
val SemanticColors.unreadIndicator val SemanticColors.unreadIndicator
get() = iconAccentTertiary get() = iconAccentTertiary
@ -181,9 +180,9 @@ internal fun ColorAliasesPreview() = ElementPreview {
backgroundColor = Color.Black, backgroundColor = Color.Black,
foregroundColor = Color.White, foregroundColor = Color.White,
colors = persistentMapOf( colors = persistentMapOf(
"roomListRoomName" to MaterialTheme.roomListRoomName(), "roomListRoomName" to ElementTheme.roomListRoomName(),
"roomListRoomMessage" to MaterialTheme.roomListRoomMessage(), "roomListRoomMessage" to ElementTheme.roomListRoomMessage(),
"roomListRoomMessageDate" to MaterialTheme.roomListRoomMessageDate(), "roomListRoomMessageDate" to ElementTheme.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,