Skip to content

Commit 3d75ffe

Browse files
authored
feat: Add pure black theme (#2824)
1 parent d188d5a commit 3d75ffe

File tree

5 files changed

+20
-1
lines changed

5 files changed

+20
-1
lines changed

app/src/main/java/app/revanced/manager/MainActivity.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class MainActivity : ComponentActivity() {
8181
)
8282
val theme by vm.prefs.theme.getAsState()
8383
val dynamicColor by vm.prefs.dynamicColor.getAsState()
84+
val pureBlackTheme by vm.prefs.pureBlackTheme.getAsState()
8485

8586
EventEffect(vm.legacyImportActivityFlow) {
8687
try {
@@ -91,7 +92,8 @@ class MainActivity : ComponentActivity() {
9192

9293
ReVancedManagerTheme(
9394
darkTheme = theme == Theme.SYSTEM && isSystemInDarkTheme() || theme == Theme.DARK,
94-
dynamicColor = dynamicColor
95+
dynamicColor = dynamicColor,
96+
pureBlackTheme = pureBlackTheme
9597
) {
9698
ReVancedManager(vm)
9799
}

app/src/main/java/app/revanced/manager/domain/manager/PreferencesManager.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class PreferencesManager(
99
context: Context
1010
) : BasePreferencesManager(context, "settings") {
1111
val dynamicColor = booleanPreference("dynamic_color", true)
12+
val pureBlackTheme = booleanPreference("pure_black_theme", false)
1213
val theme = enumPreference("theme", Theme.SYSTEM)
1314

1415
val api = stringPreference("api_url", "https://api.revanced.app")

app/src/main/java/app/revanced/manager/ui/screen/settings/GeneralSettingsScreen.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package app.revanced.manager.ui.screen.settings
22

33
import android.os.Build
4+
import androidx.compose.animation.AnimatedVisibility
45
import androidx.compose.foundation.clickable
56
import androidx.compose.foundation.layout.Column
67
import androidx.compose.foundation.layout.Row
@@ -96,6 +97,14 @@ fun GeneralSettingsScreen(
9697
description = R.string.dynamic_color_description
9798
)
9899
}
100+
AnimatedVisibility(theme != Theme.LIGHT) {
101+
BooleanItem(
102+
preference = prefs.pureBlackTheme,
103+
coroutineScope = coroutineScope,
104+
headline = R.string.pure_black_theme,
105+
description = R.string.pure_black_theme_description
106+
)
107+
}
99108
}
100109
}
101110
}

app/src/main/java/app/revanced/manager/ui/theme/Theme.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ private val LightColorScheme = lightColorScheme(
8080
fun ReVancedManagerTheme(
8181
darkTheme: Boolean,
8282
dynamicColor: Boolean,
83+
pureBlackTheme: Boolean,
8384
content: @Composable () -> Unit
8485
) {
8586
val colorScheme = when {
@@ -93,6 +94,10 @@ fun ReVancedManagerTheme(
9394

9495
darkTheme -> DarkColorScheme
9596
else -> LightColorScheme
97+
}.let {
98+
if (darkTheme && pureBlackTheme)
99+
it.copy(background = Color.Black, surface = Color.Black)
100+
else it
96101
}
97102

98103
val view = LocalView.current

app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@
8686
<string name="contributors_description">View the contributors of ReVanced</string>
8787
<string name="dynamic_color">Dynamic color</string>
8888
<string name="dynamic_color_description">Adapt colors to the wallpaper</string>
89+
<string name="pure_black_theme">Pure black theme</string>
90+
<string name="pure_black_theme_description">Use pure black backgrounds for dark theme</string>
8991
<string name="theme">Theme</string>
9092
<string name="theme_description">Choose between light or dark theme</string>
9193
<string name="safeguards">Safeguards</string>

0 commit comments

Comments
 (0)