close
Skip to content

Fix custom theme colors not applying due to outdated CSS selectors an…#3799

Open
Ganeshbhargav wants to merge 1 commit intocode-charity:masterfrom
Ganeshbhargav:master
Open

Fix custom theme colors not applying due to outdated CSS selectors an…#3799
Ganeshbhargav wants to merge 1 commit intocode-charity:masterfrom
Ganeshbhargav:master

Conversation

@Ganeshbhargav
Copy link
Copy Markdown

Issue

Custom theme colors (primary/text) were not applying and remained black/white.

Cause

YouTube updated its internal CSS variables and DOM behavior.
The extension relied on the selector:
html[it-theme=custom]

However, this attribute is not consistently present, causing styles to never apply.

Fix

  • Replaced selector with :root for global application
  • Ensured style injection works regardless of attribute presence
  • Added fallback and re-injection logic to handle YouTube dynamic updates
  • Fixed masthead selector to remove dependency on custom attribute

Result

  • Custom theme colors now apply correctly
  • Works with latest YouTube UI
  • Stable even during SPA navigation

Tested on

  • Chrome
  • Latest YouTube version

@rajanarahul93
Copy link
Copy Markdown
Contributor

@Ganeshbhargav thanks for the pr!!
Can you please attach screenshots or a screen recording

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants