diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/resource/ThemeResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/resource/ThemeResourcePatch.kt index be4d004a4..9bafb4178 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/resource/ThemeResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/resource/ThemeResourcePatch.kt @@ -45,8 +45,8 @@ class ThemeResourcePatch : ResourcePatch { node.textContent = when (node.getAttribute("name")) { "yt_black0", "yt_black1", "yt_black1_opacity95", "yt_black1_opacity98", "yt_black2", "yt_black3", - "yt_black4", "yt_status_bar_background_dark", "material_grey_850" -> darkThemeBackgroundColor - ?: continue + "yt_black4", "yt_status_bar_background_dark", "material_grey_850" + -> darkThemeBackgroundColor ?: continue "yt_white1", "yt_white1_opacity95", "yt_white1_opacity98", "yt_white2", "yt_white3", "yt_white4", @@ -58,10 +58,13 @@ class ThemeResourcePatch : ResourcePatch { } // Add a dynamic background color to the colors.xml file. - addResourceColor(context, "res/values/colors.xml", - SPLASH_BACKGROUND_COLOR, lightThemeBackgroundColor!!) - addResourceColor(context, "res/values-night/colors.xml", - SPLASH_BACKGROUND_COLOR, darkThemeBackgroundColor!!) + lightThemeBackgroundColor?.let { + addColorResource(context, "res/values/colors.xml", SPLASH_BACKGROUND_COLOR, it) + } + + darkThemeBackgroundColor?.let { + addColorResource(context, "res/values-night/colors.xml", SPLASH_BACKGROUND_COLOR, it) + } // Edit splash screen files and change the background color. val splashScreenResourceFiles = listOf( @@ -87,7 +90,7 @@ class ThemeResourcePatch : ResourcePatch { return PatchResultSuccess() } - private fun addResourceColor( + private fun addColorResource( context: ResourceContext, resourceFile: String, colorName: String,