File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe/ui/theme Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ import androidx.compose.material3.MaterialTheme
55import androidx.compose.material3.darkColorScheme
66import androidx.compose.material3.lightColorScheme
77import androidx.compose.runtime.Composable
8+ import androidx.compose.ui.graphics.Color
9+ import androidx.compose.ui.platform.LocalContext
10+ import androidx.preference.PreferenceManager
811
912private val LightColors = lightColorScheme(
1013 primary = md_theme_light_primary,
@@ -70,10 +73,22 @@ private val DarkColors = darkColorScheme(
7073 scrim = md_theme_dark_scrim,
7174)
7275
76+ private val BlackColors = DarkColors .copy(background = Color .Black )
77+
7378@Composable
7479fun AppTheme (useDarkTheme : Boolean = isSystemInDarkTheme(), content : @Composable () -> Unit ) {
80+ val sharedPreferences = PreferenceManager .getDefaultSharedPreferences(LocalContext .current)
81+ val theme = sharedPreferences.getString(" theme" , " auto_device_theme" )
82+ val nightTheme = sharedPreferences.getString(" night_theme" , " dark_theme" )
83+
7584 MaterialTheme (
76- colorScheme = if (useDarkTheme) DarkColors else LightColors ,
85+ colorScheme = if (! useDarkTheme) {
86+ LightColors
87+ } else if (theme == " black_theme" || nightTheme == " black_theme" ) {
88+ BlackColors
89+ } else {
90+ DarkColors
91+ },
7792 content = content
7893 )
7994}
You can’t perform that action at this time.
0 commit comments