FranklinDM / Swarth

Modifies web pages to use a dark color scheme or based on the user's preferences
Mozilla Public License 2.0
2 stars 0 forks source link

Stylesheet processor misses background on pixiv's dark theme unless you do a cached reload (i.e. NOT a Ctrl+F5) #5

Open NintendoManiac64 opened 2 years ago

NintendoManiac64 commented 2 years ago

This was tested with a completely new copy of Pale Moon portable 31.0.0

And for reference, in order to even access pixiv nowadays, you must first have "dom.webcomponents.enabled" set to 'true' in Pale Moon's about:config. From there, in order to enable pixiv's dark theme, you must be signed into an account on pixiv and then manually enable the dark theme by toggling the according switch in the drop-down menu that appears when you click your profile picture located in the top-right of any pixiv page.

 

Anyway, the issue is quite simple. If your pixiv account is set to use the dark theme then, whenever you first visit a non-cached page (e.g. the first time you navigate to an artist pixiv page), swarth's stylesheet processor won't fully "kick-in" and will miss processing the background unless you manually reload the page a second time. You can tell if this is the case because pixiv's default dark theme uses a dark-ish grey background while swarth by default uses a full-on black background (interestingly, it seems that swarth's colors for text and links are still correctly applied no matter what).

That being said, you can still reliably make swarth's stylesheet processor fail to activate by simply doing a complete uncached reload of the artist's page via Ctrl+F5 (or holding shift while clicking the GUI reload button).

I tested this using the following page, though it seems to occur with any artist:

fofajardo commented 2 years ago

I'm not sure if there is anything actionable on the extension-side since this involves WebComponents, which changes a lot in terms of how style sheets are handled and processed. I'm guessing that there might be a race condition.

fofajardo commented 1 year ago

Possibly related: https://github.com/m-khvoinitsky/dark-background-light-text-extension/commit/6f1192636ab363dedd961a4061a8f7b438df18d5