diff --git a/core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt b/core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt index 2ad0109fed..6e0ad2c4ad 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt @@ -57,7 +57,7 @@ fun IconButton( } } val shape = RoundedCornerShape(style.metrics.cornerSize) - val background = style.colors.backgroundFor(buttonState) + val backgroundColor by style.colors.backgroundFor(buttonState) Box( modifier = modifier .defaultMinSize(style.metrics.minSize.width, style.metrics.minSize.height) @@ -70,7 +70,7 @@ fun IconButton( ) .clip(shape) .padding(style.metrics.padding) - .background(background.value), + .background(backgroundColor), propagateMinConstraints = true, contentAlignment = Alignment.Center, content = { diff --git a/core/src/main/kotlin/org/jetbrains/jewel/styling/IconButtonMetrics.kt b/core/src/main/kotlin/org/jetbrains/jewel/styling/IconButtonMetrics.kt index a06571196e..fb4b108504 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/styling/IconButtonMetrics.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/styling/IconButtonMetrics.kt @@ -29,14 +29,13 @@ interface IconButtonColors { @Composable fun backgroundFor(state: ButtonState) = rememberUpdatedState( - state.chooseValue( - normal = background, - disabled = backgroundDisabled, - focused = backgroundFocused, - pressed = backgroundPressed, - hovered = backgroundHovered, - active = background, - ), + when { + !state.isEnabled -> backgroundDisabled + state.isPressed -> backgroundPressed + state.isHovered -> backgroundHovered + state.isFocused -> backgroundFocused + else -> background + } ) } diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiIconButtonStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiIconButtonStyling.kt index ea2bf83d9d..ebdf0bc829 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiIconButtonStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiIconButtonStyling.kt @@ -8,6 +8,7 @@ import androidx.compose.runtime.Stable import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp +import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme import org.jetbrains.jewel.styling.IconButtonColors import org.jetbrains.jewel.styling.IconButtonMetrics @@ -61,8 +62,8 @@ data class IntUiIconButtonColors( background: Color = Color.Unspecified, backgroundDisabled: Color = Color.Unspecified, backgroundFocused: Color = background, - backgroundPressed: Color = IntUiLightTheme.colors.grey(12), - backgroundHovered: Color = IntUiLightTheme.colors.grey(11), + backgroundPressed: Color = IntUiDarkTheme.colors.grey(5), + backgroundHovered: Color = IntUiDarkTheme.colors.grey(3), ) = IntUiIconButtonColors( background,