Skip to content

Commit

Permalink
feat(youtube/theme): add option to color the seekbar
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Dec 29, 2022
1 parent c363997 commit 53b91fe
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
)

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

0 comments on commit 53b91fe

Please sign in to comment.