From 800b82ed747f35248b58a77361e6784d1d1dc483 Mon Sep 17 00:00:00 2001 From: OxrxL <108184954+OxrxL@users.noreply.github.com> Date: Tue, 25 Oct 2022 08:30:42 +0200 Subject: [PATCH] feat(youtube/theme): extend theming to splash screen (#769) --- .../patches/youtube/layout/theme/patch/ThemePatch.kt | 12 ++++++++++-- src/main/resources/theme/values-night-v31/styles.xml | 8 ++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/theme/values-night-v31/styles.xml diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/ThemePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/ThemePatch.kt index 1f5cdb6d7..a9d527bcb 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/ThemePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/theme/patch/ThemePatch.kt @@ -9,6 +9,8 @@ import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch +import app.revanced.util.resources.ResourceUtils +import app.revanced.util.resources.ResourceUtils.copyResources import org.w3c.dom.Element @Patch @@ -31,16 +33,22 @@ class ThemePatch : ResourcePatch { node.textContent = when (node.getAttribute("name")) { "yt_black1", "yt_black1_opacity95", "yt_black1_opacity98", "yt_black2", "yt_black3", "yt_black4", "yt_status_bar_background_dark", "material_grey_100", "material_grey_50", "material_grey_600", - "material_grey_800", "material_grey_850", "material_grey_900", "material_grey_white_1000" -> darkThemeBackgroundColor + "material_grey_800", "material_grey_850", "material_grey_900", "material_grey_white_1000", + "sud_glif_v3_dialog_background_color_dark" -> darkThemeBackgroundColor "yt_white1", "yt_white1_opacity95", "yt_white1_opacity98", "yt_white2", "yt_white3", - "yt_white4" -> lightThemeBackgroundColor + "yt_white4", "sud_glif_v3_dialog_background_color_light" -> lightThemeBackgroundColor else -> continue } } } + // copies the resource file to change the splash screen color + context.copyResources("theme", + ResourceUtils.ResourceGroup("values-night-v31", "styles.xml") + ) + return PatchResultSuccess() } diff --git a/src/main/resources/theme/values-night-v31/styles.xml b/src/main/resources/theme/values-night-v31/styles.xml new file mode 100644 index 000000000..53da895f8 --- /dev/null +++ b/src/main/resources/theme/values-night-v31/styles.xml @@ -0,0 +1,8 @@ + + + +