feat: Add pure black theme (#2824)

This commit is contained in:
alieRN
2025-10-25 06:46:50 +03:00
committed by GitHub
parent d188d5a410
commit 3d75ffe6a7
5 changed files with 20 additions and 1 deletions

View File

@@ -81,6 +81,7 @@ class MainActivity : ComponentActivity() {
)
val theme by vm.prefs.theme.getAsState()
val dynamicColor by vm.prefs.dynamicColor.getAsState()
val pureBlackTheme by vm.prefs.pureBlackTheme.getAsState()
EventEffect(vm.legacyImportActivityFlow) {
try {
@@ -91,7 +92,8 @@ class MainActivity : ComponentActivity() {
ReVancedManagerTheme(
darkTheme = theme == Theme.SYSTEM && isSystemInDarkTheme() || theme == Theme.DARK,
dynamicColor = dynamicColor
dynamicColor = dynamicColor,
pureBlackTheme = pureBlackTheme
) {
ReVancedManager(vm)
}

View File

@@ -9,6 +9,7 @@ class PreferencesManager(
context: Context
) : BasePreferencesManager(context, "settings") {
val dynamicColor = booleanPreference("dynamic_color", true)
val pureBlackTheme = booleanPreference("pure_black_theme", false)
val theme = enumPreference("theme", Theme.SYSTEM)
val api = stringPreference("api_url", "https://api.revanced.app")

View File

@@ -1,6 +1,7 @@
package app.revanced.manager.ui.screen.settings
import android.os.Build
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@@ -96,6 +97,14 @@ fun GeneralSettingsScreen(
description = R.string.dynamic_color_description
)
}
AnimatedVisibility(theme != Theme.LIGHT) {
BooleanItem(
preference = prefs.pureBlackTheme,
coroutineScope = coroutineScope,
headline = R.string.pure_black_theme,
description = R.string.pure_black_theme_description
)
}
}
}
}

View File

@@ -80,6 +80,7 @@ private val LightColorScheme = lightColorScheme(
fun ReVancedManagerTheme(
darkTheme: Boolean,
dynamicColor: Boolean,
pureBlackTheme: Boolean,
content: @Composable () -> Unit
) {
val colorScheme = when {
@@ -93,6 +94,10 @@ fun ReVancedManagerTheme(
darkTheme -> DarkColorScheme
else -> LightColorScheme
}.let {
if (darkTheme && pureBlackTheme)
it.copy(background = Color.Black, surface = Color.Black)
else it
}
val view = LocalView.current

View File

@@ -86,6 +86,8 @@
<string name="contributors_description">View the contributors of ReVanced</string>
<string name="dynamic_color">Dynamic color</string>
<string name="dynamic_color_description">Adapt colors to the wallpaper</string>
<string name="pure_black_theme">Pure black theme</string>
<string name="pure_black_theme_description">Use pure black backgrounds for dark theme</string>
<string name="theme">Theme</string>
<string name="theme_description">Choose between light or dark theme</string>
<string name="safeguards">Safeguards</string>