Skip to content

Commit 0ab1e56

Browse files
authored
Merge pull request #4365 from element-hq/feature/bma/fixColors
Fix some icon colors
2 parents dc95331 + deb97cc commit 0ab1e56

File tree

108 files changed

+236
-217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+236
-217
lines changed

libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/ColorUtil.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,21 @@ fun Boolean.toSecondaryEnabledColor(): Color {
2828
ElementTheme.colors.textDisabled
2929
}
3030
}
31+
32+
@Composable
33+
fun Boolean.toIconEnabledColor(): Color {
34+
return if (this) {
35+
ElementTheme.colors.iconPrimary
36+
} else {
37+
ElementTheme.colors.iconDisabled
38+
}
39+
}
40+
41+
@Composable
42+
fun Boolean.toIconSecondaryEnabledColor(): Color {
43+
return if (this) {
44+
ElementTheme.colors.iconSecondary
45+
} else {
46+
ElementTheme.colors.iconDisabled
47+
}
48+
}

libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/components/preferences/components/PreferenceIcon.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import io.element.android.libraries.designsystem.components.list.ListItemContent
2525
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
2626
import io.element.android.libraries.designsystem.preview.PreviewGroup
2727
import io.element.android.libraries.designsystem.theme.components.Icon
28-
import io.element.android.libraries.designsystem.toSecondaryEnabledColor
28+
import io.element.android.libraries.designsystem.toIconSecondaryEnabledColor
2929

3030
@Composable
3131
fun preferenceIcon(
@@ -68,7 +68,7 @@ private fun PreferenceIcon(
6868
imageVector = icon,
6969
resourceId = iconResourceId,
7070
contentDescription = null,
71-
tint = tintColor ?: enabled.toSecondaryEnabledColor(),
71+
tint = tintColor ?: enabled.toIconSecondaryEnabledColor(),
7272
modifier = Modifier
7373
.size(24.dp),
7474
)

libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/ListItem.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,14 @@ sealed interface ListItemStyle {
193193

194194
@Composable
195195
fun leadingIconColor() = when (this) {
196-
Default -> ListItemDefaultColors.icon
196+
Default -> ListItemDefaultColors.leadingIcon
197197
Primary -> ElementTheme.colors.iconPrimary
198198
Destructive -> ElementTheme.colors.iconCriticalPrimary
199199
}
200200

201201
@Composable
202202
fun trailingIconColor() = when (this) {
203-
Default -> ListItemDefaultColors.icon
203+
Default -> ListItemDefaultColors.trailingIcon
204204
Primary -> ElementTheme.colors.iconPrimary
205205
Destructive -> ElementTheme.colors.iconCriticalPrimary
206206
}
@@ -210,15 +210,16 @@ object ListItemDefaultColors {
210210
val headline: Color @Composable get() = ElementTheme.colors.textPrimary
211211
val headlineDisabled: Color @Composable get() = ElementTheme.colors.textDisabled
212212
val supportingText: Color @Composable get() = ElementTheme.materialColors.onSurfaceVariant
213-
val icon: Color @Composable get() = ElementTheme.colors.iconTertiary
213+
val leadingIcon: Color @Composable get() = ElementTheme.colors.iconSecondary
214+
val trailingIcon: Color @Composable get() = ElementTheme.colors.iconPrimary
214215
val iconDisabled: Color @Composable get() = ElementTheme.colors.iconDisabled
215216

216217
val colors: ListItemColors
217218
@Composable get() = ListItemDefaults.colors(
218219
headlineColor = headline,
219220
supportingColor = supportingText,
220-
leadingIconColor = icon,
221-
trailingIconColor = icon,
221+
leadingIconColor = leadingIcon,
222+
trailingIconColor = trailingIcon,
222223
disabledHeadlineColor = headlineDisabled,
223224
disabledLeadingIconColor = iconDisabled,
224225
disabledTrailingIconColor = iconDisabled,
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)