diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/forceheader/PremiumHeadingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/forceheader/PremiumHeadingPatch.kt
deleted file mode 100644
index 6c3b5a9cc..000000000
--- a/src/main/kotlin/app/revanced/patches/youtube/layout/forceheader/PremiumHeadingPatch.kt
+++ /dev/null
@@ -1,82 +0,0 @@
-package app.revanced.patches.youtube.layout.forceheader
-
-import app.revanced.patcher.data.ResourceContext
-import app.revanced.patcher.patch.PatchException
-import app.revanced.patcher.patch.ResourcePatch
-import app.revanced.patcher.patch.annotation.CompatiblePackage
-import app.revanced.patcher.patch.annotation.Patch
-import app.revanced.patches.youtube.utils.settings.SettingsPatch
-import java.nio.file.Files
-import java.nio.file.StandardCopyOption
-import kotlin.io.path.exists
-
-@Patch(
- name = "Force premium heading",
- description = "Forces premium heading on the homepage.",
- dependencies = [SettingsPatch::class],
- compatiblePackages = [
- CompatiblePackage(
- "com.google.android.youtube",
- [
- "18.25.40",
- "18.27.36",
- "18.29.38",
- "18.30.37",
- "18.31.40",
- "18.32.39",
- "18.33.40",
- "18.34.38",
- "18.35.36",
- "18.36.39",
- "18.37.36",
- "18.38.44",
- "18.39.41",
- "18.40.34",
- "18.41.39"
- ]
- )
- ],
- use = false
-)
-@Suppress("unused")
-object PremiumHeadingPatch : ResourcePatch() {
- override fun execute(context: ResourceContext) {
- val resDirectory = context["res"]
- if (!resDirectory.isDirectory)
- throw PatchException("The res folder can not be found.")
-
- val (original, replacement) = "yt_premium_wordmark_header" to "yt_wordmark_header"
- val modes = arrayOf("light", "dark")
-
- arrayOf("xxxhdpi", "xxhdpi", "xhdpi", "hdpi", "mdpi").forEach { size ->
- val headingDirectory = resDirectory.resolve("drawable-$size")
- modes.forEach { mode ->
- val fromPath = headingDirectory.resolve("${original}_$mode.png").toPath()
- val toPath = headingDirectory.resolve("${replacement}_$mode.png").toPath()
-
- if (!fromPath.exists())
- throw PatchException("The file $fromPath does not exist in the resources. Therefore, this patch can not succeed.")
- Files.copy(
- fromPath,
- toPath,
- StandardCopyOption.REPLACE_EXISTING
- )
- }
- }
-
- val prefs = context["res/xml/revanced_prefs.xml"]
- prefs.writeText(
- prefs.readText()
- .replace(
- "HEADER_SWITCH",
- "FORCE_PREMIUM_HEADER"
- ).replace(
- "Header switch",
- "force-premium-heading"
- )
- )
-
- SettingsPatch.updatePatchStatus("force-premium-heading")
-
- }
-}
diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/header/PremiumHeadingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/header/PremiumHeadingPatch.kt
new file mode 100644
index 000000000..acb9c8054
--- /dev/null
+++ b/src/main/kotlin/app/revanced/patches/youtube/layout/header/PremiumHeadingPatch.kt
@@ -0,0 +1,91 @@
+package app.revanced.patches.youtube.layout.header
+
+import app.revanced.patcher.data.ResourceContext
+import app.revanced.patcher.patch.PatchException
+import app.revanced.patcher.patch.ResourcePatch
+import app.revanced.patcher.patch.annotation.CompatiblePackage
+import app.revanced.patcher.patch.annotation.Patch
+import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.booleanPatchOption
+import app.revanced.patches.youtube.utils.settings.SettingsPatch
+import app.revanced.util.resources.ResourceHelper.updatePatchStatusHeader
+import kotlin.io.path.copyTo
+
+@Patch(
+ name = "Premium heading",
+ description = "Show or hide the premium heading.",
+ dependencies = [SettingsPatch::class],
+ compatiblePackages = [
+ CompatiblePackage(
+ "com.google.android.youtube",
+ [
+ "18.25.40",
+ "18.27.36",
+ "18.29.38",
+ "18.30.37",
+ "18.31.40",
+ "18.32.39",
+ "18.33.40",
+ "18.34.38",
+ "18.35.36",
+ "18.36.39",
+ "18.37.36",
+ "18.38.44",
+ "18.39.41",
+ "18.40.34",
+ "18.41.39"
+ ]
+ )
+ ]
+)
+@Suppress("unused")
+object PremiumHeadingPatch : ResourcePatch() {
+ private const val DEFAULT_HEADING_RES = "yt_wordmark_header"
+ private const val PREMIUM_HEADING_RES = "yt_premium_wordmark_header"
+
+ private val UsePremiumHeading by booleanPatchOption(
+ key = "UsePremiumHeading",
+ default = true,
+ title = "Use premium heading",
+ description = "Whether to use the premium heading.",
+ required = true,
+ )
+
+ override fun execute(context: ResourceContext) {
+ val resDirectory = context["res"]
+
+ val (original, replacement) = if (UsePremiumHeading == true)
+ PREMIUM_HEADING_RES to DEFAULT_HEADING_RES
+ else
+ DEFAULT_HEADING_RES to PREMIUM_HEADING_RES
+
+ val variants = arrayOf("light", "dark")
+
+ arrayOf(
+ "xxxhdpi",
+ "xxhdpi",
+ "xhdpi",
+ "hdpi",
+ "mdpi"
+ ).mapNotNull { dpi ->
+ resDirectory.resolve("drawable-$dpi").takeIf { it.exists() }?.toPath()
+ }.also {
+ if (it.isEmpty())
+ throw PatchException("The drawable folder can not be found. Therefore, the patch can not be applied.")
+ }.forEach { path ->
+
+ variants.forEach { mode ->
+ val fromPath = path.resolve("${original}_$mode.png")
+ val toPath = path.resolve("${replacement}_$mode.png")
+
+ fromPath.copyTo(toPath, true)
+ }
+ }
+
+ val header = if (UsePremiumHeading == true)
+ "Premium"
+ else
+ "Default"
+
+ context.updatePatchStatusHeader(header)
+ }
+}
diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt
index 9c8a0c71a..51e5117e6 100644
--- a/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt
+++ b/src/main/kotlin/app/revanced/patches/youtube/utils/resourceid/SharedResourceIdPatch.kt
@@ -84,7 +84,6 @@ object SharedResourceIdPatch : ResourcePatch() {
var TotalTime: Long = -1
var VideoQualityBottomSheet: Long = -1
var VideoZoomIndicatorLayout: Long = -1
- var WordMarkHeader: Long = -1
var YoutubeControlsOverlay: Long = -1
var YtOutlineArrowTimeBlack: Long = -1
var YtOutlineFireBlack: Long = -1
@@ -168,7 +167,6 @@ object SharedResourceIdPatch : ResourcePatch() {
TotalTime = find(STRING, "total_time")
VideoQualityBottomSheet = find(LAYOUT, "video_quality_bottom_sheet_list_fragment_title")
VideoZoomIndicatorLayout = find(ID, "video_zoom_indicator_layout")
- WordMarkHeader = find(ATTR, "ytWordmarkHeader")
YoutubeControlsOverlay = find(ID, "youtube_controls_overlay")
YtOutlineArrowTimeBlack = find(DRAWABLE, "yt_outline_arrow_time_black_24")
YtOutlineFireBlack = find(DRAWABLE, "yt_outline_fire_black_24")
diff --git a/src/main/resources/youtube/settings/values-v21/strings.xml b/src/main/resources/youtube/settings/values-v21/strings.xml
index cab05ed6f..ef36120eb 100644
--- a/src/main/resources/youtube/settings/values-v21/strings.xml
+++ b/src/main/resources/youtube/settings/values-v21/strings.xml
@@ -63,6 +63,7 @@
@string/revanced_hide_shorts_player_subscriptions_button_summary_on
@string/revanced_hide_shorts_player_subscriptions_button_title
+ Stock
Stock
MMT
Revancify Blue
diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
index 067fce936..7922e5b75 100644
--- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml
+++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
@@ -436,6 +436,7 @@
+