youtube icon indicating copy to clipboard operation
youtube copied to clipboard

"theme":"default" forces dark mode - bug

Open alidan opened this issue 2 years ago • 14 comments

PROBLEM: youtube for some reason wont stop forceing dark mode and I hate dark mode

SOLUTION: light mode enforced by extension

ALTERNATIVES: other extensions forcing a light mode skin or scripts that just force light mode

RELEVANCE / SCOPE: could enforce whatever mode you want, be it light or dark by extension, this way when youtube either in cookies or itself decided to force someone to use light or dark, its changed before it's an issue, it would probably also be possible to add in themes for the site via the extension this way as well if that was ever an interest.

"SIDE EFFECTS": not sure if there would be a conflict

CONTEXT: for some reason youtube started to force darkmode on me, i'm not sure what is forcing dark mode, I cant get youtube to knock it off, nothing I do lasts longer than 2 or 3 videos/page clicks, forcing the light mode setting in extension would remove me having to go into the settings, enable the header click light mode, go into the settings again, disable the header and then do it again the next time a page refreshes or I move to another video. // Thank you!

SHORT Table (Summary)
Problem light mode wont stay light
Solution force light mode in extension settings
Alternatives scripts/other extensions
Scope a setting to enforce whatever mode, that you want
Side effects none that I Can think of
Context youtube being broken and a bandaid fix.

alidan avatar Apr 14 '22 23:04 alidan

for the sake of just being on the same page, while I Think it could be handled by third party extensions or scripts or ccs, I have not found one that works in the script area, and ccs most people are not trying to remake light/dark mode, extensions there may be something that enforces it but nothing that advertises that as a feature.

alidan avatar Apr 15 '22 04:04 alidan

after another website has acted up, I found out that chrome had enforced an 'all pages will be dark mode regardless of your will' flag, having turned this off, it fixed the need for this for me, however in the several hours I was looking this up prior to making this request, it seems that many people have both dark mode and light mode issues where settings don't stick, so I do believe there is still value in this for others and potentially me in the future because god knows the flag will trip again and ill forget that was what fixed it and not know what to do again.

alidan avatar Apr 23 '22 16:04 alidan

Funny you made this issue, because after playing with themes in ImprovedTube (testing)3.949 YT keeps reverting to Dark mode for me no matter what. It stops doing it if I disable this extension, but re enabling it and opening new YT page makes it go to dark mode again. Switching modes in YT preferences doesnt work long term as long as extension is enabled.

raszpl avatar Jun 12 '22 20:06 raszpl

oh good, it's not just me, I also had a dark mode flag in chrome that was screwing with everything enabled, I disabled that, thought that it may have been the problem, went I think about 30 pages before it just started to force dark mode again. I mean I get that some people like dark mode, I get that in some scenarios it's helpful, but for me its so hard to read anything when its done badly and I think there is too big a contrast with youtubes dark mode that it makes text a nightmare.

alidan avatar Jun 12 '22 20:06 alidan

in ImprovedTube (testing)3.949 setting any theme at all and switching back to default leaves this in config:

"theme":"default",

and this somehow forces YT to go into dark mode. Exporting settings, deleting this line, importing back and voila no more forced black mode. no idea WTF is happening.

raszpl avatar Jun 12 '22 20:06 raszpl

google deciding it knows what's best for you yet again, see chrome having a flag that forced dark mode that was enabled by default.

potentially, youtube sees the "theme":"d and just thinks darkmode, I mean I have seen dumber crap happen

alidan avatar Jun 12 '22 20:06 alidan

its not YT

ImprovedTube.themes = function () {
    this.myColors();

    if (this.schedule() === true && this.isset(this.storage.theme)) {
....
PREF.f6 = '400';
        } else if (PREF.f6.length === 3) {
            PREF.f6 = '4' + PREF.f6.substr(1);

will trigger when "theme":"default" because theme isset, F6=400 forced dark mode https://gist.github.com/irazasyed/0d7f43f752ae4cfd160a11ced0d9a618#file-dark-youtube-js-L22

TLDR: click on ImprovedTube , top right three dot icon, settings, export settings, save to HDD, now open in text editor, find "theme":"default", delete it (including one ,), now import back, and its fixed

and please change the name of this Issue to '"theme":"default" forces dark mode" so @victor-savinov can see this is a bug

raszpl avatar Jun 12 '22 20:06 raszpl

edited my earlier post

raszpl avatar Jun 12 '22 20:06 raszpl

This was already a feature request shouldn't it be a new thing for a bug? I can make it if that's the case, but I think you know more about this than me.

also, it seems when I import the settings it just readds "theme":"default"

alidan avatar Jun 12 '22 21:06 alidan

YT switching to dark mode is a bug in ImprovedTube, so no, your post is not a feature request :) you spotted a bug, I managed to find the source - ImprovedTube is directly overriding YT cookie and forcing dark mode

my previous solution wasnt complete, I missed a step:

  • click on ImprovedTube extension icon, top right three dot icon, settings, export settings, save to HDD
  • now open in text editor
  • find "theme":"default",
  • delete it including one period if there is more than one item listed
  • in ImprovedTube click Reset Settings, this is the step I missed previously, importing settings concatenates them instead of overriding so missing "theme" wasnt deleting it from the system
  • import back edited file

or a lot faster solution doing same thing:

  • click on ImprovedTube extension icon
  • right click in the ImprovedTube popup
  • select Developer tools/Inspect
  • in the console type satus.storage.remove('theme')

I dont know what makes this "theme":"default" key being created, but there is no way of deleting it inside ImprovedTube by just clicking some button, and its mere existence forces dark mode :(

It might be this part https://github.com/code-for-charity/YouTube-Extension/blob/dd48267640e7c21ebc386b9d7c923c374f94b2db/ui/script.js#L4709 meaning this is permanently set every time you decide to set theme to my colors and then back to default, with no way of removing it afterwards

EDIT: damn it, somehow satus.storage.remove('theme') is not enough, it keeps coming back :/ EDIT2: satus.storage.remove('theme') is working after all, might of needed extension restart to stick

raszpl avatar Jun 12 '22 23:06 raszpl

beyond changing the title, I have no idea how to change it from feature request to bug, I still think that making a new one is better overall and will probably do that when I wake up.

and thanks this seems to have helped, at least through 5 refreshes and it applied to every open youtube window, something it didn't do before.

alidan avatar Jun 13 '22 10:06 alidan

Awesome thread!! Will invite you guys to the team so you can change labels or assign people.

( @aidan what was the chrome-flag's name bothering on other websites?)

ImprovedTube avatar Jun 14 '22 04:06 ImprovedTube

Awesome thread!! Will invite you guys to the team so you can change labels or assign people.

( @aidan what was the chrome-flag's name bothering on other websites?)

I can only make an assumption because it fixed itself right after I turned that flag off, it was one of the chan backup sites for when threads die, I don't remember which one exactly though, its entirely possible it was a placebo effect and it just stopped doing it on a chrome restart.

alidan avatar Jun 14 '22 22:06 alidan

probably

Navigate to chrome://flags and enable the #darken-websites-checkbox-in-theme-setting

that was the first thing I stumbled upon when researching why my YT went dark before narrowing it down to ImprovedTube bug

raszpl avatar Jun 15 '22 00:06 raszpl

or a lot faster solution doing same thing:

* click on ImprovedTube extension icon

* right click in the ImprovedTube popup

* select Developer tools/Inspect

* in the console type satus.storage.remove('theme')

Thanks! This worked for me on Firefox:

  1. Find the extension Internal UUID: about:debugging#/runtime/this-firefox
  2. Open add-on in a new tab: moz-extension://_UUID_GOES_HERE/ui/options.html
  3. Right-click > Inspect
  4. In the console type satus.storage.remove('theme')

compmix avatar Nov 16 '22 19:11 compmix

@raszpl @alidan @compmix

thanks again for caring. maybe check this in v4.4

= not sure the following is optimal.

https://github.com/code-for-charity/ImprovedTube-for-YouTube/blob/master/content-scripts/website-context/youtube-features/themes.js

https://github.com/code-for-charity/ImprovedTube-for-YouTube/blob/9bbbcae981d90321970c7e16b15e4f8578870945/content-scripts/website-context/youtube-features/shortcuts.js#L623-L659

ImprovedTube avatar Mar 21 '23 06:03 ImprovedTube