Fix textSelectionColors

This commit is contained in:
Andrew 2024-06-21 20:50:14 +09:30
parent f2959073ec
commit d8f032ff9e
2 changed files with 8 additions and 6 deletions

View File

@ -23,6 +23,7 @@ import org.thoughtcrime.securesms.ui.color.LocalColors
import org.thoughtcrime.securesms.ui.color.OceanDark
import org.thoughtcrime.securesms.ui.color.OceanLight
import org.thoughtcrime.securesms.ui.color.colors
import org.thoughtcrime.securesms.ui.color.textSelectionColors
/**
* Apply a Material2 compose theme based on user selections in SharedPreferences.
@ -47,15 +48,10 @@ fun SessionMaterialTheme(
typography = sessionTypography,
shapes = sessionShapes,
) {
val textSelectionColors = TextSelectionColors(
handleColor = LocalColors.current.primary,
backgroundColor = LocalColors.current.primary.copy(alpha = 0.5f)
)
CompositionLocalProvider(
LocalColors provides colors,
LocalContentColor provides colors.text,
LocalTextSelectionColors provides textSelectionColors,
LocalTextSelectionColors provides colors.textSelectionColors,
) {
content()
}

View File

@ -4,6 +4,7 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.text.selection.TextSelectionColors
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.MaterialTheme
import androidx.compose.material.RadioButtonDefaults
@ -56,6 +57,11 @@ interface Colors {
val primaryButtonOutline get() = primaryButtonFill
}
val Colors.textSelectionColors get() = TextSelectionColors(
handleColor = primary,
backgroundColor = primary.copy(alpha = 0.5f)
)
data class ClassicDark(override val primary: Color = primaryGreen): Colors {
override val isLight = false
override val danger = dangerDark