mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-01-18 00:33:58 +00:00
feat: Add pure black theme (#2824)
This commit is contained in:
@@ -81,6 +81,7 @@ class MainActivity : ComponentActivity() {
|
|||||||
)
|
)
|
||||||
val theme by vm.prefs.theme.getAsState()
|
val theme by vm.prefs.theme.getAsState()
|
||||||
val dynamicColor by vm.prefs.dynamicColor.getAsState()
|
val dynamicColor by vm.prefs.dynamicColor.getAsState()
|
||||||
|
val pureBlackTheme by vm.prefs.pureBlackTheme.getAsState()
|
||||||
|
|
||||||
EventEffect(vm.legacyImportActivityFlow) {
|
EventEffect(vm.legacyImportActivityFlow) {
|
||||||
try {
|
try {
|
||||||
@@ -91,7 +92,8 @@ class MainActivity : ComponentActivity() {
|
|||||||
|
|
||||||
ReVancedManagerTheme(
|
ReVancedManagerTheme(
|
||||||
darkTheme = theme == Theme.SYSTEM && isSystemInDarkTheme() || theme == Theme.DARK,
|
darkTheme = theme == Theme.SYSTEM && isSystemInDarkTheme() || theme == Theme.DARK,
|
||||||
dynamicColor = dynamicColor
|
dynamicColor = dynamicColor,
|
||||||
|
pureBlackTheme = pureBlackTheme
|
||||||
) {
|
) {
|
||||||
ReVancedManager(vm)
|
ReVancedManager(vm)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class PreferencesManager(
|
|||||||
context: Context
|
context: Context
|
||||||
) : BasePreferencesManager(context, "settings") {
|
) : BasePreferencesManager(context, "settings") {
|
||||||
val dynamicColor = booleanPreference("dynamic_color", true)
|
val dynamicColor = booleanPreference("dynamic_color", true)
|
||||||
|
val pureBlackTheme = booleanPreference("pure_black_theme", false)
|
||||||
val theme = enumPreference("theme", Theme.SYSTEM)
|
val theme = enumPreference("theme", Theme.SYSTEM)
|
||||||
|
|
||||||
val api = stringPreference("api_url", "https://api.revanced.app")
|
val api = stringPreference("api_url", "https://api.revanced.app")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package app.revanced.manager.ui.screen.settings
|
package app.revanced.manager.ui.screen.settings
|
||||||
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
@@ -96,6 +97,14 @@ fun GeneralSettingsScreen(
|
|||||||
description = R.string.dynamic_color_description
|
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
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ private val LightColorScheme = lightColorScheme(
|
|||||||
fun ReVancedManagerTheme(
|
fun ReVancedManagerTheme(
|
||||||
darkTheme: Boolean,
|
darkTheme: Boolean,
|
||||||
dynamicColor: Boolean,
|
dynamicColor: Boolean,
|
||||||
|
pureBlackTheme: Boolean,
|
||||||
content: @Composable () -> Unit
|
content: @Composable () -> Unit
|
||||||
) {
|
) {
|
||||||
val colorScheme = when {
|
val colorScheme = when {
|
||||||
@@ -93,6 +94,10 @@ fun ReVancedManagerTheme(
|
|||||||
|
|
||||||
darkTheme -> DarkColorScheme
|
darkTheme -> DarkColorScheme
|
||||||
else -> LightColorScheme
|
else -> LightColorScheme
|
||||||
|
}.let {
|
||||||
|
if (darkTheme && pureBlackTheme)
|
||||||
|
it.copy(background = Color.Black, surface = Color.Black)
|
||||||
|
else it
|
||||||
}
|
}
|
||||||
|
|
||||||
val view = LocalView.current
|
val view = LocalView.current
|
||||||
|
|||||||
@@ -86,6 +86,8 @@
|
|||||||
<string name="contributors_description">View the contributors of ReVanced</string>
|
<string name="contributors_description">View the contributors of ReVanced</string>
|
||||||
<string name="dynamic_color">Dynamic color</string>
|
<string name="dynamic_color">Dynamic color</string>
|
||||||
<string name="dynamic_color_description">Adapt colors to the wallpaper</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">Theme</string>
|
||||||
<string name="theme_description">Choose between light or dark theme</string>
|
<string name="theme_description">Choose between light or dark theme</string>
|
||||||
<string name="safeguards">Safeguards</string>
|
<string name="safeguards">Safeguards</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user