feat(youtube/theme): add option to color the seekbar

This commit is contained in:
oSumAtrIX 2022-12-29 18:39:54 +01:00
parent c363997568
commit 53b91fe2b5
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -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.",
)
)
}
}