Use right colors on ForcedDarkElementTheme
This commit is contained in:
parent
07b9a8456b
commit
5720b2df1a
6 changed files with 43 additions and 4 deletions
|
|
@ -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,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue