Skip to content

Commit 0e44829

Browse files
committed
fix: Fix broken contrast with pure black theme
Closes #227
1 parent ab0a179 commit 0e44829

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

app/src/main/java/org/nsh07/wikireader/ui/AppScreen.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ fun AppScreen(
238238
slideInHorizontally(
239239
initialOffsetX = { it / 4 },
240240
animationSpec = motionScheme.defaultSpatialSpec()
241-
) + fadeIn()
241+
) + fadeIn(motionScheme.defaultEffectsSpec())
242242
else
243243
fadeIn(animationSpec = tween(220, delayMillis = 90)) +
244244
scaleIn(
@@ -251,7 +251,7 @@ fun AppScreen(
251251
slideOutHorizontally(
252252
targetOffsetX = { -it / 4 },
253253
animationSpec = motionScheme.fastSpatialSpec()
254-
) + fadeOut()
254+
) + fadeOut(motionScheme.fastEffectsSpec())
255255
else
256256
fadeOut(animationSpec = tween(90))
257257
},
@@ -260,7 +260,7 @@ fun AppScreen(
260260
slideInHorizontally(
261261
initialOffsetX = { -it / 4 },
262262
animationSpec = motionScheme.defaultSpatialSpec()
263-
) + fadeIn()
263+
) + fadeIn(motionScheme.defaultEffectsSpec())
264264
else
265265
fadeIn(animationSpec = tween(220, delayMillis = 90)) +
266266
scaleIn(
@@ -273,7 +273,7 @@ fun AppScreen(
273273
slideOutHorizontally(
274274
targetOffsetX = { it / 4 },
275275
animationSpec = motionScheme.fastSpatialSpec()
276-
) + fadeOut()
276+
) + fadeOut(motionScheme.fastEffectsSpec())
277277
else
278278
fadeOut(animationSpec = tween(90))
279279
}
@@ -388,8 +388,8 @@ fun AppScreen(
388388

389389
AnimatedVisibility(
390390
backStack.last() !is HomeSubscreen.Image,
391-
enter = fadeIn(),
392-
exit = fadeOut()
391+
enter = fadeIn(motionScheme.slowEffectsSpec()),
392+
exit = fadeOut(motionScheme.fastEffectsSpec())
393393
) {
394394
StatusBarProtection()
395395
}

app/src/main/java/org/nsh07/wikireader/ui/theme/Theme.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import androidx.compose.ui.platform.LocalContext
1919
import androidx.compose.ui.platform.LocalView
2020
import androidx.core.view.WindowCompat
2121
import com.materialkolor.dynamiccolor.ColorSpec
22-
import com.materialkolor.ktx.animateColorScheme
2322
import com.materialkolor.rememberDynamicColorScheme
2423

2524
private val DarkColorScheme = darkColorScheme(
@@ -70,22 +69,21 @@ fun WikiReaderTheme(
7069
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
7170
}
7271
}
73-
CustomTopBarColors.black = blackTheme
72+
CustomTopBarColors.black = blackTheme && darkTheme
7473

7574
val dynamicColorScheme = rememberDynamicColorScheme(
7675
seedColor = when (seedColor) {
7776
Color.White -> colorScheme.primary
7877
else -> seedColor
7978
},
8079
isDark = darkTheme,
81-
specVersion = ColorSpec.SpecVersion.SPEC_2025,
82-
isAmoled = blackTheme
80+
specVersion = if (blackTheme && darkTheme) ColorSpec.SpecVersion.SPEC_2021 else ColorSpec.SpecVersion.SPEC_2025,
81+
isAmoled = blackTheme && darkTheme
8382
)
8483

85-
val scheme = animateColorScheme(
84+
val scheme =
8685
if (seedColor == Color.White && !(blackTheme && darkTheme)) colorScheme
8786
else dynamicColorScheme
88-
)
8987

9088
MaterialExpressiveTheme(
9189
colorScheme = scheme,

0 commit comments

Comments
 (0)