From 53b91fe2b5a41f1a63deec8d919f2a1bc1cae12a Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Thu, 29 Dec 2022 18:39:54 +0100 Subject: [PATCH] feat(youtube/theme): add option to color the seekbar --- .../youtube/layout/theme/patch/ThemePatch.kt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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 e0f79fe9b..b70466776 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 @@ -23,6 +23,7 @@ class ThemePatch : ResourcePatch { override fun execute(context: ResourceContext): PatchResult { val darkThemeBackgroundColor = darkThemeBackgroundColor!! val lightThemeBackgroundColor = lightThemeBackgroundColor!! + val darkThemeSeekbarColor = darkThemeSeekbarColor!! context.xmlEditor["res/values/colors.xml"].use { editor -> val resourcesNode = editor.file.getElementsByTagName("resources").item(0) as Element @@ -35,15 +36,17 @@ class ThemePatch : ResourcePatch { "yt_black4", "yt_status_bar_background_dark", "material_grey_850" -> darkThemeBackgroundColor "yt_white1", "yt_white1_opacity95", "yt_white1_opacity98", "yt_white2", "yt_white3", "yt_white4", - -> lightThemeBackgroundColor + -> lightThemeBackgroundColor + "inline_time_bar_colorized_bar_played_color_dark" -> darkThemeSeekbarColor else -> continue } } } // copies the resource file to change the splash screen color - context.copyResources("theme", + context.copyResources( + "theme", ResourceUtils.ResourceGroup("values-night-v31", "styles.xml") ) @@ -68,5 +71,14 @@ class ThemePatch : ResourcePatch { description = "The background color of the light theme. Can be a hex color or a resource reference.", ) ) + + var darkThemeSeekbarColor: String? by option( + PatchOption.StringOption( + key = "darkThemeSeekbarColor", + default = "#ffff0000", + title = "Dark theme seekbar color", + description = "The background color of the seekbar of the dark theme. Leave empty for default color.", + ) + ) } }