From db7e053e413e89870fad11e78a2d366c8b917027 Mon Sep 17 00:00:00 2001 From: Francisco N <4259909+francisconoriega@users.noreply.github.com> Date: Tue, 17 Sep 2024 08:58:05 -0600 Subject: [PATCH] Fixed Text Component order for color (#596) Fixed Null Pointer in IDE sample on non INTUI themes Co-authored-by: Francisco Noriega --- ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Text.kt | 2 +- .../main/kotlin/org/jetbrains/jewel/ui/component/Tooltip.kt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Text.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Text.kt index 54a5802c7..c36d9169c 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Text.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Text.kt @@ -79,7 +79,7 @@ public fun Text( onTextLayout: (TextLayoutResult) -> Unit = {}, style: TextStyle = JewelTheme.defaultTextStyle, ) { - val textColor = color.takeOrElse { LocalContentColor.current.takeOrElse { style.color } } + val textColor = color.takeOrElse { style.color.takeOrElse { LocalContentColor.current } } val mergedStyle = style.merge( diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Tooltip.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Tooltip.kt index 718b77ec2..4f1592182 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Tooltip.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Tooltip.kt @@ -24,6 +24,7 @@ import androidx.compose.ui.window.PopupPositionProviderAtPosition import org.jetbrains.jewel.foundation.ExperimentalJewelApi import org.jetbrains.jewel.foundation.theme.JewelTheme import org.jetbrains.jewel.foundation.theme.LocalContentColor +import org.jetbrains.jewel.foundation.theme.LocalTextStyle import org.jetbrains.jewel.foundation.theme.OverrideDarkMode import org.jetbrains.jewel.ui.component.styling.TooltipStyle import org.jetbrains.jewel.ui.theme.tooltipStyle @@ -39,7 +40,10 @@ public fun Tooltip( ) { TooltipArea( tooltip = { - CompositionLocalProvider(LocalContentColor provides style.colors.content) { + CompositionLocalProvider( + LocalContentColor provides style.colors.content, + LocalTextStyle provides LocalTextStyle.current.copy(color = style.colors.content), + ) { Box( modifier = Modifier.shadow(