mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Use right colors on ForcedDarkElementTheme
This commit is contained in:
+9
-1
@@ -16,6 +16,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import io.element.android.compound.colors.SemanticColorsLightDark
|
||||
|
||||
/**
|
||||
* Can be used to force a composable in dark theme.
|
||||
@@ -23,6 +24,7 @@ import androidx.compose.ui.graphics.toArgb
|
||||
*/
|
||||
@Composable
|
||||
fun ForcedDarkElementTheme(
|
||||
colors: SemanticColorsLightDark,
|
||||
lightStatusBar: Boolean = false,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
@@ -47,5 +49,11 @@ fun ForcedDarkElementTheme(
|
||||
)
|
||||
}
|
||||
}
|
||||
ElementTheme(darkTheme = true, lightStatusBar = lightStatusBar, content = content)
|
||||
ElementTheme(
|
||||
darkTheme = true,
|
||||
compoundLight = colors.light,
|
||||
compoundDark = colors.dark,
|
||||
lightStatusBar = lightStatusBar,
|
||||
content = content,
|
||||
)
|
||||
}
|
||||
|
||||
+4
-1
@@ -19,6 +19,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.github.takahirom.roborazzi.captureRoboImage
|
||||
import io.element.android.compound.colors.SemanticColorsLightDark
|
||||
import io.element.android.compound.screenshot.utils.screenshotFile
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.compound.theme.ForcedDarkElementTheme
|
||||
@@ -42,7 +43,9 @@ class ForcedDarkElementThemeTest {
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
Text(text = "Outside")
|
||||
ForcedDarkElementTheme {
|
||||
ForcedDarkElementTheme(
|
||||
colors = SemanticColorsLightDark.default,
|
||||
) {
|
||||
Surface {
|
||||
Box(modifier = Modifier.fillMaxSize()) {
|
||||
Text(text = "Inside ForcedDarkElementTheme", modifier = Modifier.align(Alignment.Center))
|
||||
|
||||
Reference in New Issue
Block a user