From cb306b52191be31481108466bdf4b383d8cb0958 Mon Sep 17 00:00:00 2001 From: nrobi144 Date: Sun, 19 Apr 2026 05:55:09 +0300 Subject: [PATCH] fix(desktop): icon picker shows selected state with background highlight Replace tint-only selection with Surface background + primaryContainer color so the selected icon is clearly visible in the workspace editor. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../amethyst/desktop/ui/deck/AppDrawer.kt | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/deck/AppDrawer.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/deck/AppDrawer.kt index 44807eff5..f98466bd4 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/deck/AppDrawer.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/deck/AppDrawer.kt @@ -904,19 +904,36 @@ private fun WorkspaceEditorDialog( ) // Icon picker Text("Icon", style = MaterialTheme.typography.labelMedium) - FlowRow(horizontalArrangement = Arrangement.spacedBy(4.dp)) { + FlowRow( + horizontalArrangement = Arrangement.spacedBy(4.dp), + verticalArrangement = Arrangement.spacedBy(4.dp), + ) { + val isSelected = { iName: String -> iName == iconName } WorkspaceIcons.availableNames.forEach { iName -> - IconButton(onClick = { iconName = iName }) { - Icon( - WorkspaceIcons.resolve(iName), - iName, - tint = - if (iName == iconName) { - MaterialTheme.colorScheme.primary - } else { - MaterialTheme.colorScheme.onSurfaceVariant - }, - ) + Surface( + modifier = Modifier.size(40.dp).clickable { iconName = iName }, + shape = RoundedCornerShape(8.dp), + color = + if (isSelected(iName)) { + MaterialTheme.colorScheme.primaryContainer + } else { + Color.Transparent + }, + tonalElevation = if (isSelected(iName)) 4.dp else 0.dp, + ) { + Box(contentAlignment = Alignment.Center) { + Icon( + WorkspaceIcons.resolve(iName), + iName, + modifier = Modifier.size(24.dp), + tint = + if (isSelected(iName)) { + MaterialTheme.colorScheme.primary + } else { + MaterialTheme.colorScheme.onSurfaceVariant + }, + ) + } } } }