Optimise text colours in the navigation bar and module buttons to ensure readability in different states

This commit is contained in:
ShirkNeko
2025-03-20 23:35:54 +08:00
parent c3b0ecb95a
commit f1e87f0846
2 changed files with 35 additions and 7 deletions

View File

@@ -140,13 +140,17 @@ private fun BottomBar(navController: NavHostController) {
}, },
icon = { icon = {
if (isCurrentDestOnBackStack) { if (isCurrentDestOnBackStack) {
Icon(destination.iconSelected, stringResource(destination.label)) Icon(destination.iconSelected, stringResource(destination.label), tint = Color.White)
} else { } else {
Icon(destination.iconNotSelected, stringResource(destination.label)) Icon(destination.iconNotSelected, stringResource(destination.label))
} }
}, },
label = { Text(stringResource(destination.label)) }, label = { Text(stringResource(destination.label)) },
alwaysShowLabel = false alwaysShowLabel = false,
colors = androidx.compose.material3.NavigationBarItemDefaults.colors(
selectedTextColor = Color.Black,
unselectedTextColor = MaterialTheme.colorScheme.onSurfaceVariant
)
) )
} }
} }

View File

@@ -111,6 +111,7 @@ import shirkneko.zako.sukisu.ui.viewmodel.ModuleViewModel
import java.io.BufferedReader import java.io.BufferedReader
import java.io.InputStreamReader import java.io.InputStreamReader
import java.util.zip.ZipInputStream import java.util.zip.ZipInputStream
import androidx.compose.ui.graphics.Color
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Destination<RootGraph> @Destination<RootGraph>
@@ -121,6 +122,7 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
val snackBarHost = LocalSnackbarHost.current val snackBarHost = LocalSnackbarHost.current
val scope = rememberCoroutineScope() val scope = rememberCoroutineScope()
val confirmDialog = rememberConfirmDialog() val confirmDialog = rememberConfirmDialog()
val buttonTextColor = androidx.compose.ui.graphics.Color.Black
val selectZipLauncher = rememberLauncherForActivityResult( val selectZipLauncher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.StartActivityForResult() contract = ActivityResultContracts.StartActivityForResult()
@@ -354,7 +356,12 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
contentDescription = moduleInstall contentDescription = moduleInstall
) )
}, },
text = { Text(text = moduleInstall) } text = {
Text(
text = moduleInstall,
color = buttonTextColor
)
}
) )
} }
}, },
@@ -768,7 +775,11 @@ fun ModuleItem(
navigator.navigate(ExecuteModuleActionScreenDestination(module.dirId)) navigator.navigate(ExecuteModuleActionScreenDestination(module.dirId))
viewModel.markNeedRefresh() viewModel.markNeedRefresh()
}, },
contentPadding = ButtonDefaults.TextButtonContentPadding contentPadding = ButtonDefaults.TextButtonContentPadding,
colors = ButtonDefaults.filledTonalButtonColors(
containerColor = Color.White,
contentColor = Color.Black
)
) { ) {
Icon( Icon(
modifier = Modifier.size(20.dp), modifier = Modifier.size(20.dp),
@@ -794,7 +805,11 @@ fun ModuleItem(
enabled = !module.remove && module.enabled, enabled = !module.remove && module.enabled,
onClick = { onClick(module) }, onClick = { onClick(module) },
interactionSource = interactionSource, interactionSource = interactionSource,
contentPadding = ButtonDefaults.TextButtonContentPadding contentPadding = ButtonDefaults.TextButtonContentPadding,
colors = ButtonDefaults.filledTonalButtonColors(
containerColor = Color.White,
contentColor = Color.Black
)
) { ) {
Icon( Icon(
modifier = Modifier.size(20.dp), modifier = Modifier.size(20.dp),
@@ -820,7 +835,11 @@ fun ModuleItem(
enabled = !module.remove, enabled = !module.remove,
onClick = { onUpdate(module) }, onClick = { onUpdate(module) },
shape = ButtonDefaults.textShape, shape = ButtonDefaults.textShape,
contentPadding = ButtonDefaults.TextButtonContentPadding contentPadding = ButtonDefaults.TextButtonContentPadding,
colors = ButtonDefaults.filledTonalButtonColors(
containerColor = Color.White,
contentColor = Color.Black
)
) { ) {
Icon( Icon(
modifier = Modifier.size(20.dp), modifier = Modifier.size(20.dp),
@@ -843,7 +862,11 @@ fun ModuleItem(
FilledTonalButton( FilledTonalButton(
modifier = Modifier.defaultMinSize(52.dp, 32.dp), modifier = Modifier.defaultMinSize(52.dp, 32.dp),
onClick = { onUninstallClicked(module) }, onClick = { onUninstallClicked(module) },
contentPadding = ButtonDefaults.TextButtonContentPadding contentPadding = ButtonDefaults.TextButtonContentPadding,
colors = ButtonDefaults.filledTonalButtonColors(
containerColor = Color.White,
contentColor = Color.Black
)
) { ) {
if (!module.remove) { if (!module.remove) {
Icon( Icon(
@@ -856,6 +879,7 @@ fun ModuleItem(
modifier = Modifier.size(20.dp).rotate(180f), modifier = Modifier.size(20.dp).rotate(180f),
imageVector = Icons.Outlined.Refresh, imageVector = Icons.Outlined.Refresh,
contentDescription = null, contentDescription = null,
) )
} }
if (!module.hasActionScript && !module.hasWebUi && updateUrl.isEmpty()) { if (!module.hasActionScript && !module.hasWebUi && updateUrl.isEmpty()) {