Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
User avatar
seadragon
Hobby Astronomer
Hobby Astronomer
Posts: 20
Joined: 2021-06-18, 04:39

Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by seadragon » 2021-06-22, 20:17

Dear Moonchild,

I have been developing a dark theme for my website, and I have found that after an user changes their setting on Preferences > Colors, the page's @media queries do not update immediately, which means that the user has to refresh the page until the dark theme shows. In other browsers that inherit system preferences, the page updates as soon as the user changes their system setting.

I believe this is an expected behavior now, but I suggest that changing the behavior will give the user a smooth experience.

New Tobin Paradigm

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by New Tobin Paradigm » 2021-06-22, 20:30

Yeah, I don't think we shall be doing this because that would mean a bunch of stateful pluming and observers and cache invalidation that would just slow the code execution down to the point of the kinds of shit that these damned js megalibs cause.

You are just going to have to deal with the fact that any change in preferences will need the content to be reloaded to take effect.

User avatar
seadragon
Hobby Astronomer
Hobby Astronomer
Posts: 20
Joined: 2021-06-18, 04:39

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by seadragon » 2021-06-22, 20:36

I see, so this will be much difficult to implement! Then so be it, as the current behavior is acceptable.
New Tobin Paradigm wrote:
2021-06-22, 20:30
Yeah, I don't think we shall be doing this because that would mean...
Thanks for your promptly explanation, Mr. Tobin!

New Tobin Paradigm

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by New Tobin Paradigm » 2021-06-22, 20:49

That is only my surface understanding of how the rendering engine works. I am sure it is much more complex than I even expressed. Would basically need a lot of redesign.

Chrome code should be instant though for the upcoming ui.color_scheme preference (because that bit was added to it a long time ago and is much simpler to accomplish anyway) which will provide a bool selector that would allow Themes to easily hack them selves into a dark mode (in much the same way aero glass surfaces works) without the need of companion extensions.

The prefers-color-scheme preference will have a setting to follow the ui color scheme preference which means you will also be able to sync them. If we ever manage to get the system color scheme in it means you can have it all be light or dark down the line for Windows 10+/GTK3 Builds (Windows 7 and 8 and GTK2 have no facility for this) or any combination there of as you see fit. However, the system color scheme thing is annoyingly annoying so that will be some time away if at all.. But you will still be able to set the preference to what you want much sooner.

You will likely see Dark Mode in add-on Themes experimentally before the Default Theme though. It would be a lot of work. Most of the Dark Theme overrides would be to address Windows versions for cases like how Aero or Aero-only-in-name has no Dark version because reasons. Classic and Aero-lite likely have little to no need to specify anything. On the Not-Windows it would be mostly relating to the constant issue of black on black textboxes in the Default Theme because GTK does a good job of skinning everything else and of course for add-on Themes which are much more absolute on style. This is a far better prospective solution than just hard forcing the application to use Adwaita Light such as was Mozilla's original solution and I believe still was before they dropped GTK2 completely.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35576
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by Moonchild » 2021-06-23, 02:22

New Tobin Paradigm wrote:
2021-06-22, 20:49
That is only my surface understanding of how the rendering engine works. I am sure it is much more complex than I even expressed.
It's pretty much correct. Following such a change would mean that flipping the pref would need a full page and style re-parse, recomposition and rendering. Effectively a reload without requesting anything from the network (so a half-way reload of sorts) and invalidating the viewer (pre-rendered page). Of course that would have to be triggered with observers left right and center if you want that to be a real-time response to a pref flip, and would add a ton of complexity we really don't want for something that just needs a refresh (which isn't so strange when you effectively tell the browser that it needs to display the content for a different display medium). It's the safer, less error-prone option.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4971
Joined: 2015-12-09, 15:45
Contact:

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by moonbat » 2021-06-24, 07:26

Users of my Autopagecolor extension will get a desktop notification when it changes the color theme, so they can refresh the page if need be. I've seen the code behavior on Youtube and I can confirm that Youtube instantly changes itself when you change the setting. It remains for other sites to follow.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

New Tobin Paradigm

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by New Tobin Paradigm » 2021-06-24, 10:07

Youtube might dynamicly monitor shit like that though tiggering restyling and that isn't likely a good thing.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35576
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by Moonchild » 2021-06-24, 13:55

Why do you think YT is slow?
That's right, because of this kind of nonsense.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4971
Joined: 2015-12-09, 15:45
Contact:

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by moonbat » 2021-06-24, 14:06

Hey, web devs gotta eat too you know, if they stopped dicking with a website without adding anything new in terms of functionality they'd be out of work!
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35576
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by Moonchild » 2021-06-24, 16:28

Off-topic:
Sarcasm aside, "Agile" does cause this. If you don't have anything new to show in 2 weeks, then you failed your Agile development goal and will be punished.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4971
Joined: 2015-12-09, 15:45
Contact:

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by moonbat » 2021-06-25, 01:03

Agile makes no sense in product development. It is best suited for enterprise software projects being executed for a third party customer who wants to see constant progress for the money they're paying.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35576
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by Moonchild » 2021-06-25, 02:02

Off-topic:
moonbat wrote:
2021-06-25, 01:03
Agile makes no sense in product development. It is best suited for enterprise software projects being executed for a third party customer
But that is product development. Software is a product too. An application is a product.

(and please mark off-topic)
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4971
Joined: 2015-12-09, 15:45
Contact:

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by moonbat » 2021-06-25, 02:12

Off-topic:
I mean software products, like Pale Moon itself, or say, MS Windows - where you the founder/developer decide what features to put in it and when, and are not beholden to the whims of a third party customer (usually another big company) that's paying you to do it. Very often in the latter case, the customer is clueless about requirements and they keep changing, requiring a lot of rework. So a rapid prototyping model works better where you can demonstrate visible progress every few weeks on schedule and provide a working product ever so often with one or other feature completed. As opposed to the traditional 'waterfall' model of software development where you gather requirements, design, build, test and deploy in steps without ever going back to the previous step.
There is no reason for a standalone packaged software meant for regular end users to follow this model, and yet here we are with Chrome/Windows/Firefox.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35576
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by Moonchild » 2021-06-25, 02:16

Off-topic:
moonbat wrote:
2021-06-25, 02:12
There is no reason for a standalone packaged software meant for regular end users to follow this model, and yet here we are with Chrome/Windows/Firefox.
The "customer" in those cases are corporate management of Google/Microsoft/mozilla. They don't know jack about the actual development work; they just want features X Y and Z (usually based on some airy presentation from middle management) and then it's passed down the chain.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4971
Joined: 2015-12-09, 15:45
Contact:

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by moonbat » 2021-06-25, 02:18

Off-topic:
Yes, unfortunately. Someone at Google discovered Agile, decided it would be great to apply and the rest is history.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
seadragon
Hobby Astronomer
Hobby Astronomer
Posts: 20
Joined: 2021-06-18, 04:39

Re: Enhancement request: update @media prefers-color-scheme as soon as the user changes their preference

Unread post by seadragon » 2021-06-25, 04:11

moonbat wrote:
2021-06-24, 07:26
Users of my Autopagecolor extension will get a desktop notification when it changes the color theme, so they can refresh the page if need be.
Off-topic:
BTW: Thanks for your Autopagecolor extension! It works like a charm.

Locked