From d43ea0e01bb67da85bbe94f19ab8c9a7771089e2 Mon Sep 17 00:00:00 2001 From: Renan Lukas <14964993+RenanLukas@users.noreply.github.com> Date: Tue, 12 Dec 2023 16:30:51 -0300 Subject: [PATCH] Fix dark mode divider color in JetpackDropdownMenu --- .../components/menu/dropdown/JetpackDropdownMenu.kt | 5 +++-- .../ui/compose/components/menu/dropdown/MenuColors.kt | 10 +++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/compose/components/menu/dropdown/JetpackDropdownMenu.kt b/WordPress/src/main/java/org/wordpress/android/ui/compose/components/menu/dropdown/JetpackDropdownMenu.kt index da49d88b983e..bf670c042237 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/compose/components/menu/dropdown/JetpackDropdownMenu.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/compose/components/menu/dropdown/JetpackDropdownMenu.kt @@ -14,7 +14,6 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import me.saket.cascade.CascadeDropdownMenu @@ -47,7 +46,9 @@ fun JetpackDropdownMenu(menuItems: List, defaultItem: MenuEleme is MenuElementData.Item -> Item(element, onMenuItemClick) } if (element.hasDivider) { - Divider() + Divider( + color = itemDividerColor(), + ) } } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/compose/components/menu/dropdown/MenuColors.kt b/WordPress/src/main/java/org/wordpress/android/ui/compose/components/menu/dropdown/MenuColors.kt index 3024df8c4589..a890f02bf9ad 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/compose/components/menu/dropdown/MenuColors.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/compose/components/menu/dropdown/MenuColors.kt @@ -1,11 +1,12 @@ package org.wordpress.android.ui.compose.components.menu.dropdown +import androidx.compose.material.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color import org.wordpress.android.ui.compose.theme.AppColor @Composable -fun isLightTheme(): Boolean = androidx.compose.material.MaterialTheme.colors.isLight +fun isLightTheme(): Boolean = MaterialTheme.colors.isLight @Composable fun itemContentColor(): Color = if (isLightTheme()) { @@ -20,3 +21,10 @@ fun itemBackgroundColor(): Color = if (isLightTheme()) { } else { AppColor.DarkGray90 } + +@Composable +fun itemDividerColor(): Color = if (isLightTheme()) { + MaterialTheme.colors.onSurface.copy(alpha = 0.12f) +} else { + AppColor.Gray50 +}