mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Fix icon color.
Leading icon should be iconSecondary Trailing icon should be iconPrimary See Figma https://www.figma.com/design/G1xy0HDZKJf5TCRFmKb5d5/Compound-Android-Components?node-id=628-25757
This commit is contained in:
+18
@@ -28,3 +28,21 @@ fun Boolean.toSecondaryEnabledColor(): Color {
|
|||||||
ElementTheme.colors.textDisabled
|
ElementTheme.colors.textDisabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun Boolean.toIconEnabledColor(): Color {
|
||||||
|
return if (this) {
|
||||||
|
ElementTheme.colors.iconPrimary
|
||||||
|
} else {
|
||||||
|
ElementTheme.colors.iconDisabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun Boolean.toIconSecondaryEnabledColor(): Color {
|
||||||
|
return if (this) {
|
||||||
|
ElementTheme.colors.iconSecondary
|
||||||
|
} else {
|
||||||
|
ElementTheme.colors.iconDisabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+2
-2
@@ -25,7 +25,7 @@ import io.element.android.libraries.designsystem.components.list.ListItemContent
|
|||||||
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
|
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
|
||||||
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
import io.element.android.libraries.designsystem.preview.PreviewGroup
|
||||||
import io.element.android.libraries.designsystem.theme.components.Icon
|
import io.element.android.libraries.designsystem.theme.components.Icon
|
||||||
import io.element.android.libraries.designsystem.toSecondaryEnabledColor
|
import io.element.android.libraries.designsystem.toIconSecondaryEnabledColor
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun preferenceIcon(
|
fun preferenceIcon(
|
||||||
@@ -68,7 +68,7 @@ private fun PreferenceIcon(
|
|||||||
imageVector = icon,
|
imageVector = icon,
|
||||||
resourceId = iconResourceId,
|
resourceId = iconResourceId,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = tintColor ?: enabled.toSecondaryEnabledColor(),
|
tint = tintColor ?: enabled.toIconSecondaryEnabledColor(),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(24.dp),
|
.size(24.dp),
|
||||||
)
|
)
|
||||||
|
|||||||
+6
-5
@@ -193,14 +193,14 @@ sealed interface ListItemStyle {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun leadingIconColor() = when (this) {
|
fun leadingIconColor() = when (this) {
|
||||||
Default -> ListItemDefaultColors.icon
|
Default -> ListItemDefaultColors.leadingIcon
|
||||||
Primary -> ElementTheme.colors.iconPrimary
|
Primary -> ElementTheme.colors.iconPrimary
|
||||||
Destructive -> ElementTheme.colors.iconCriticalPrimary
|
Destructive -> ElementTheme.colors.iconCriticalPrimary
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun trailingIconColor() = when (this) {
|
fun trailingIconColor() = when (this) {
|
||||||
Default -> ListItemDefaultColors.icon
|
Default -> ListItemDefaultColors.trailingIcon
|
||||||
Primary -> ElementTheme.colors.iconPrimary
|
Primary -> ElementTheme.colors.iconPrimary
|
||||||
Destructive -> ElementTheme.colors.iconCriticalPrimary
|
Destructive -> ElementTheme.colors.iconCriticalPrimary
|
||||||
}
|
}
|
||||||
@@ -210,15 +210,16 @@ object ListItemDefaultColors {
|
|||||||
val headline: Color @Composable get() = ElementTheme.colors.textPrimary
|
val headline: Color @Composable get() = ElementTheme.colors.textPrimary
|
||||||
val headlineDisabled: Color @Composable get() = ElementTheme.colors.textDisabled
|
val headlineDisabled: Color @Composable get() = ElementTheme.colors.textDisabled
|
||||||
val supportingText: Color @Composable get() = ElementTheme.materialColors.onSurfaceVariant
|
val supportingText: Color @Composable get() = ElementTheme.materialColors.onSurfaceVariant
|
||||||
val icon: Color @Composable get() = ElementTheme.colors.iconTertiary
|
val leadingIcon: Color @Composable get() = ElementTheme.colors.iconSecondary
|
||||||
|
val trailingIcon: Color @Composable get() = ElementTheme.colors.iconPrimary
|
||||||
val iconDisabled: Color @Composable get() = ElementTheme.colors.iconDisabled
|
val iconDisabled: Color @Composable get() = ElementTheme.colors.iconDisabled
|
||||||
|
|
||||||
val colors: ListItemColors
|
val colors: ListItemColors
|
||||||
@Composable get() = ListItemDefaults.colors(
|
@Composable get() = ListItemDefaults.colors(
|
||||||
headlineColor = headline,
|
headlineColor = headline,
|
||||||
supportingColor = supportingText,
|
supportingColor = supportingText,
|
||||||
leadingIconColor = icon,
|
leadingIconColor = leadingIcon,
|
||||||
trailingIconColor = icon,
|
trailingIconColor = trailingIcon,
|
||||||
disabledHeadlineColor = headlineDisabled,
|
disabledHeadlineColor = headlineDisabled,
|
||||||
disabledLeadingIconColor = iconDisabled,
|
disabledLeadingIconColor = iconDisabled,
|
||||||
disabledTrailingIconColor = iconDisabled,
|
disabledTrailingIconColor = iconDisabled,
|
||||||
|
|||||||
Reference in New Issue
Block a user