From a663f0e86c77b3dcb8b98123786a4f947bd6414f Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 29 Jun 2023 10:02:51 +0200 Subject: [PATCH] Fix placeholoder color issue (with a workaround) --- .../roomlist/impl/components/RoomSummaryPlaceholderRow.kt | 3 ++- .../libraries/designsystem/atomic/atoms/PlaceholderAtom.kt | 3 ++- .../android/libraries/designsystem/theme/ColorAliases.kt | 6 ++++++ .../android/libraries/theme/compound/CompoundColors.kt | 3 ++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryPlaceholderRow.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryPlaceholderRow.kt index 412723cdb4..8ce5be0a85 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryPlaceholderRow.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryPlaceholderRow.kt @@ -36,6 +36,7 @@ import io.element.android.libraries.designsystem.atomic.atoms.PlaceholderAtom import io.element.android.libraries.designsystem.components.avatar.AvatarSize import io.element.android.libraries.designsystem.preview.ElementPreviewDark import io.element.android.libraries.designsystem.preview.ElementPreviewLight +import io.element.android.libraries.designsystem.theme.roomListPlaceholder import io.element.android.libraries.theme.ElementTheme /** @@ -55,7 +56,7 @@ internal fun RoomSummaryPlaceholderRow( modifier = Modifier .size(AvatarSize.RoomListItem.dp) .align(Alignment.CenterVertically) - .background(color = ElementTheme.colors.textPlaceholder, shape = CircleShape) + .background(color = ElementTheme.colors.roomListPlaceholder, shape = CircleShape) ) Column( modifier = Modifier diff --git a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/atomic/atoms/PlaceholderAtom.kt b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/atomic/atoms/PlaceholderAtom.kt index 897e71efbf..250177399e 100644 --- a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/atomic/atoms/PlaceholderAtom.kt +++ b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/atomic/atoms/PlaceholderAtom.kt @@ -29,6 +29,7 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import io.element.android.libraries.designsystem.preview.ElementPreviewDark import io.element.android.libraries.designsystem.preview.ElementPreviewLight +import io.element.android.libraries.designsystem.theme.roomListPlaceholder import io.element.android.libraries.theme.ElementTheme @Composable @@ -36,7 +37,7 @@ fun PlaceholderAtom( width: Dp, height: Dp, modifier: Modifier = Modifier, - color: Color = ElementTheme.colors.textPlaceholder, + color: Color = ElementTheme.colors.roomListPlaceholder, ) { Box( modifier = modifier 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 13703a475a..5a2ed2069b 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 @@ -22,6 +22,8 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview import io.element.android.libraries.designsystem.preview.ElementPreviewDark import io.element.android.libraries.designsystem.preview.ElementPreviewLight +import io.element.android.libraries.theme.ElementTheme +import io.element.android.libraries.theme.compound.generated.SemanticColors import io.element.android.libraries.theme.previews.ColorListPreview import kotlinx.collections.immutable.persistentMapOf @@ -40,6 +42,9 @@ fun MaterialTheme.roomListRoomMessageDate() = colorScheme.secondary @Composable fun MaterialTheme.roomListUnreadIndicator() = colorScheme.primary +val SemanticColors.roomListPlaceholder + get() = bgSubtleSecondary + @Preview @Composable internal fun ColorAliasesLightPreview() = ElementPreviewLight { ContentToPreview() } @@ -58,6 +63,7 @@ private fun ContentToPreview() { "roomListRoomMessage" to MaterialTheme.roomListRoomMessage(), "roomListRoomMessageDate" to MaterialTheme.roomListRoomMessageDate(), "roomListUnreadIndicator" to MaterialTheme.roomListUnreadIndicator(), + "roomListPlaceholder" to ElementTheme.colors.roomListPlaceholder, ) ) } diff --git a/libraries/theme/src/main/kotlin/io/element/android/libraries/theme/compound/CompoundColors.kt b/libraries/theme/src/main/kotlin/io/element/android/libraries/theme/compound/CompoundColors.kt index 83a5c67b48..fb5d44f880 100644 --- a/libraries/theme/src/main/kotlin/io/element/android/libraries/theme/compound/CompoundColors.kt +++ b/libraries/theme/src/main/kotlin/io/element/android/libraries/theme/compound/CompoundColors.kt @@ -89,7 +89,8 @@ internal val compoundColorsDark = SemanticColors( textInfoPrimary = DarkDesignTokens.colorBlue900, textOnSolidPrimary = DarkDesignTokens.colorThemeBg, bgSubtlePrimary = DarkDesignTokens.colorGray400, - bgSubtleSecondary = DarkDesignTokens.colorBgSubtleSecondaryLevel0, + // The value DarkDesignTokens.colorBgSubtleSecondaryLevel0 is defined to colorThemeBg, this is not correct, so override the value here until this is fixed, + bgSubtleSecondary = DarkDesignTokens.colorGray300, // DarkDesignTokens.colorBgSubtleSecondaryLevel0 bgCanvasDefault = DarkDesignTokens.colorBgCanvasDefaultLevel1, bgCanvasDisabled = DarkDesignTokens.colorGray200, bgActionPrimaryRest = DarkDesignTokens.colorGray1400,