Skip to content

Commit 310a0ba

Browse files
Update Theme.kt in Jetcaster to make the app force dark (#1593)
Updating Jetcaster to only use dark color theme even when device isn't in dark mode
2 parents 035c113 + 80e441b commit 310a0ba

File tree

1 file changed

+3
-21
lines changed
  • Jetcaster/mobile/src/main/java/com/example/jetcaster/ui/theme

1 file changed

+3
-21
lines changed

Jetcaster/mobile/src/main/java/com/example/jetcaster/ui/theme/Theme.kt

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,13 @@
1717
package com.example.jetcaster.ui.theme
1818

1919
import android.os.Build
20-
import androidx.compose.foundation.isSystemInDarkTheme
2120
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
2221
import androidx.compose.material3.MaterialExpressiveTheme
2322
import androidx.compose.material3.MotionScheme
2423
import androidx.compose.material3.darkColorScheme
2524
import androidx.compose.material3.dynamicDarkColorScheme
26-
import androidx.compose.material3.dynamicLightColorScheme
2725
import androidx.compose.material3.lightColorScheme
2826
import androidx.compose.runtime.Composable
29-
import androidx.compose.runtime.Immutable
30-
import androidx.compose.ui.graphics.Color
3127
import androidx.compose.ui.platform.LocalContext
3228
import com.example.jetcaster.designsystem.theme.JetcasterShapes
3329
import com.example.jetcaster.designsystem.theme.JetcasterTypography
@@ -470,29 +466,15 @@ private val highContrastDarkColorScheme = darkColorScheme(
470466
surfaceContainerHighest = surfaceContainerHighestDarkHighContrast,
471467
)
472468

473-
@Immutable
474-
data class ColorFamily(val color: Color, val onColor: Color, val colorContainer: Color, val onColorContainer: Color)
475-
476-
val unspecified_scheme = ColorFamily(
477-
Color.Unspecified, Color.Unspecified, Color.Unspecified, Color.Unspecified,
478-
)
479-
480469
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
481470
@Composable
482-
fun JetcasterTheme(
483-
darkTheme: Boolean = isSystemInDarkTheme(),
484-
// Dynamic color is available on Android 12+
485-
dynamicColor: Boolean = false,
486-
content: @Composable () -> Unit,
487-
) {
471+
fun JetcasterTheme(dynamicColor: Boolean = false, content: @Composable () -> Unit) {
488472
val colorScheme = when {
489473
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
490474
val context = LocalContext.current
491-
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
475+
dynamicDarkColorScheme(context)
492476
}
493-
494-
darkTheme -> darkScheme
495-
else -> lightScheme
477+
else -> darkScheme
496478
}
497479

498480
MaterialExpressiveTheme(

0 commit comments

Comments
 (0)