code-charity / youtube

[top~1 open YouTube & Video web-extension] Enrich your experience & choice! 🧰180+ options & clever features📌set+forget📌Longest-standing(been tough). Please join🧩us👨‍👩‍👧‍👧 ..⋮ {playback|content discovery|player|extra buttons|distractions|related videos|shorts|ads|quality|codec|full tab|full screen}
http://improvedtube.com
Other
3.41k stars 513 forks source link

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

Closed alidan closed 1 year ago

alidan commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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.

raszpl commented 2 years ago

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.

alidan commented 2 years ago

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.

raszpl commented 2 years ago

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.

alidan commented 2 years ago

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

raszpl commented 2 years ago

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 commented 2 years ago

edited my earlier post

alidan commented 2 years ago

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"

raszpl commented 2 years ago

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:

or a lot faster solution doing same thing:

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

alidan commented 2 years ago

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.

ImprovedTube commented 2 years ago

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?)

alidan commented 2 years ago

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.

raszpl commented 2 years ago

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

compmix commented 1 year ago

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_GOESHERE/ui/options.html
  3. Right-click > Inspect
  4. In the console type satus.storage.remove('theme')
ImprovedTube commented 1 year ago

@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