Merge pull request #4365 from element-hq/feature/bma/fixColors
Fix some icon colors
This commit is contained in:
@@ -28,3 +28,21 @@ fun Boolean.toSecondaryEnabledColor(): Color {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.PreviewGroup
|
||||
import io.element.android.libraries.designsystem.theme.components.Icon
|
||||
import io.element.android.libraries.designsystem.toSecondaryEnabledColor
|
||||
import io.element.android.libraries.designsystem.toIconSecondaryEnabledColor
|
||||
|
||||
@Composable
|
||||
fun preferenceIcon(
|
||||
@@ -68,7 +68,7 @@ private fun PreferenceIcon(
|
||||
imageVector = icon,
|
||||
resourceId = iconResourceId,
|
||||
contentDescription = null,
|
||||
tint = tintColor ?: enabled.toSecondaryEnabledColor(),
|
||||
tint = tintColor ?: enabled.toIconSecondaryEnabledColor(),
|
||||
modifier = Modifier
|
||||
.size(24.dp),
|
||||
)
|
||||
|
||||
@@ -193,14 +193,14 @@ sealed interface ListItemStyle {
|
||||
|
||||
@Composable
|
||||
fun leadingIconColor() = when (this) {
|
||||
Default -> ListItemDefaultColors.icon
|
||||
Default -> ListItemDefaultColors.leadingIcon
|
||||
Primary -> ElementTheme.colors.iconPrimary
|
||||
Destructive -> ElementTheme.colors.iconCriticalPrimary
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun trailingIconColor() = when (this) {
|
||||
Default -> ListItemDefaultColors.icon
|
||||
Default -> ListItemDefaultColors.trailingIcon
|
||||
Primary -> ElementTheme.colors.iconPrimary
|
||||
Destructive -> ElementTheme.colors.iconCriticalPrimary
|
||||
}
|
||||
@@ -210,15 +210,16 @@ object ListItemDefaultColors {
|
||||
val headline: Color @Composable get() = ElementTheme.colors.textPrimary
|
||||
val headlineDisabled: Color @Composable get() = ElementTheme.colors.textDisabled
|
||||
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 colors: ListItemColors
|
||||
@Composable get() = ListItemDefaults.colors(
|
||||
headlineColor = headline,
|
||||
supportingColor = supportingText,
|
||||
leadingIconColor = icon,
|
||||
trailingIconColor = icon,
|
||||
leadingIconColor = leadingIcon,
|
||||
trailingIconColor = trailingIcon,
|
||||
disabledHeadlineColor = headlineDisabled,
|
||||
disabledLeadingIconColor = iconDisabled,
|
||||
disabledTrailingIconColor = iconDisabled,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user