AutoPageColor

Add-ons for Pale Moon and other UXP Applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

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

AutoPageColor

Unread post by moonbat » 2021-05-06, 06:19

This is a new extension that changes the webpage color scheme from light to dark based on sunrise/sunset times for your location.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 20.1 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: 31056
Joined: 2011-08-28, 17:27
Location: Tranås, SE
Contact:

Re: AutoPageColor

Unread post by Moonchild » 2021-05-06, 08:53

Flipping the prefers-color-scheme pref? :)
"Remember, only you can prevent Earth's destruction by spelling Pale Moon with a space." -- Athenian200
Image

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

Re: AutoPageColor

Unread post by moonbat » 2021-05-06, 09:20

Yep!
I also was thinking of having per site settings for it added to PermissionsPlus, but is this set via a CSS property or javascript? Could find a way to override the javascript query but I have no idea about CSS manipulation.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 20.1 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: 31056
Joined: 2011-08-28, 17:27
Location: Tranås, SE
Contact:

Re: AutoPageColor

Unread post by Moonchild » 2021-05-06, 09:34

It's a media query. This is pure CSS in most cases.
"Remember, only you can prevent Earth's destruction by spelling Pale Moon with a space." -- Athenian200
Image

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

Re: AutoPageColor

Unread post by moonbat » 2021-05-06, 09:38

Non trivial to figure out then. UI wise I like this and PermissionsPlus the most - they perfectly integrate with the browser UI and show the power of XUL, this is something impossible with other browsers now.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

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

User avatar
Lootyhoof
Themeist
Themeist
Posts: 1499
Joined: 2012-02-09, 23:35
Location: United Kingdom

Re: AutoPageColor

Unread post by Lootyhoof » 2021-05-06, 10:02

Very interesting add-on. Maybe if I ever get round to adding dark modes to my themes based on the prefers-color-scheme pref it will make even the whole browser change based on time of day. ;)

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

Re: AutoPageColor

Unread post by moonbat » 2021-05-06, 10:16

You should definitely try that! Even the lightweight theme addons like ThemeTool could benefit from this, specify different images for different times of day.

The only thing I'm not happy about is the dependency on external servers to calculate the IP address and for geolocation. These were the only ones I could find that don't force you to use an API key with limited usage.

@Moonchild - is there a way to use the browser's built in location services to avoid this dependency? I see an interface called nsIDOMGeoPositionCoords, but how does one use it?
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 20.1 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: 31056
Joined: 2011-08-28, 17:27
Location: Tranås, SE
Contact:

Re: AutoPageColor

Unread post by Moonchild » 2021-05-06, 10:24

"Remember, only you can prevent Earth's destruction by spelling Pale Moon with a space." -- Athenian200
Image

User avatar
Night Wing
Knows the dark side
Knows the dark side
Posts: 4585
Joined: 2011-10-03, 10:19
Location: Piney Woods of Southeast Texas, USA

Re: AutoPageColor

Unread post by Night Wing » 2021-05-06, 10:41

Changing the color scheme from light to dark based on sunrise/sunset times for your location is already baked in by default in linux Mint. It's named "Redshift" and I use it all the time during the evening and night. One has to turn it on, but there is a setting (Autostart) where it will automatically start when Mint is booted.
Linux Mint 20.2 (Uma) Xfce 64 Bit with 64 Bit linux Pale Moon

User avatar
Lootyhoof
Themeist
Themeist
Posts: 1499
Joined: 2012-02-09, 23:35
Location: United Kingdom

Re: AutoPageColor

Unread post by Lootyhoof » 2021-05-06, 10:45

Redshift changes the colour temperature of the screen, not the GTK (system) theme. Though even then, that's not passed through to web pages in Pale Moon due to privacy concerns.

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

Re: AutoPageColor

Unread post by moonbat » 2021-05-06, 10:47

Will this be affected by the location sharing preferences or are those only applicable to websites?
Lootyhoof wrote:
2021-05-06, 10:45
Though even then, that's not passed through to web pages in Pale Moon due to privacy concerns.
Pale Moon's approach of directly letting you control it instead of depending on the system is best. With my extension you could spoof coordinates and set the color scheme to the opposite of your timezone if you're really paranoid ;)
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

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

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

Re: AutoPageColor

Unread post by moonbat » 2021-05-06, 12:48

Changelog for 1.1
  • Added desktop alerts :mrgreen:
  • Added configuration options for desktop alerts, and console logging.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

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

User avatar
back2themoon
Board Warrior
Board Warrior
Posts: 1933
Joined: 2012-08-19, 20:32

Re: AutoPageColor

Unread post by back2themoon » 2021-05-06, 16:56

Quite smart, thanks moonbat!

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

Re: AutoPageColor

Unread post by moonbat » 2021-05-27, 15:32

Changelog for 1.2
  • Preview alert when toggling it on/off.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

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

User avatar
Drugwash
Fanatic
Fanatic
Posts: 121
Joined: 2016-01-28, 12:08
Location: Ploieşti, Romania
Contact:

Re: AutoPageColor

Unread post by Drugwash » 2021-09-23, 10:49

moonbat wrote:
2021-05-06, 10:47
With my extension you could spoof coordinates and set the color scheme to the opposite of your timezone if you're really paranoid
That may even come out unintentionally while using the ip-api.com service. :roll: Out of curiosity I just tested my location with them and they missed longitude by 2 degrees. This could indicate errors in their geolocation database.

In my Linux Mint Cinnamon applet I use a combination of different services (kwelo.com and sunrise-sunset.org) which appears to be more accurate but requires the IP address beforehand and two subsequent sync calls.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 31056
Joined: 2011-08-28, 17:27
Location: Tranås, SE
Contact:

Re: AutoPageColor

Unread post by Moonchild » 2021-09-23, 12:59

ip-api can only do so much based on IP. It's what happens when ISPs are not subdividing their IP space very fine-grained. You can also offer suggestions for correction to them

The other option would be google which is more accurate BUT wants a full map of your local wifis to get that accurate, which is... well let's just say it's not very privacy-friendly.
Geopositioning is supposed to be a rough guide, anyway.
"Remember, only you can prevent Earth's destruction by spelling Pale Moon with a space." -- Athenian200
Image

User avatar
Drugwash
Fanatic
Fanatic
Posts: 121
Joined: 2016-01-28, 12:08
Location: Ploieşti, Romania
Contact:

Re: AutoPageColor

Unread post by Drugwash » 2021-09-23, 13:39

In my case it's an USB HSDPA modem which is assigned a limited IP range. The service mentioned above (kwelo.com, to which I am not affiliated in any way) returns the accurate coordinates based on the very same IP. Maybe their method is different, or maybe they update their database more frequently. Or it's simply a random data error. After reconnecting minutes ago - and getting a different IP in the same range - the result is now correct from ip-api.com.

I noticed there are other similar sites that sometimes return inaccurate results. While a slight deviation shouldn't harm, a larger one could produce unwanted results.
Unfortunately there are not many such services that do not require an API key, to choose from. And personally I stay as far away from anything google as possible.

Anyway it was just a heads up. Hopefully such errors are rare and of minor consequence.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 31056
Joined: 2011-08-28, 17:27
Location: Tranås, SE
Contact:

Re: AutoPageColor

Unread post by Moonchild » 2021-09-23, 19:05

Bottom line: geopositioning based on IP is at all times "best effort". It is not GPS geolocation.
"Remember, only you can prevent Earth's destruction by spelling Pale Moon with a space." -- Athenian200
Image

User avatar
Drugwash
Fanatic
Fanatic
Posts: 121
Joined: 2016-01-28, 12:08
Location: Ploieşti, Romania
Contact:

Re: AutoPageColor

Unread post by Drugwash » 2021-09-23, 20:40

Thankfully. 8-)

Post Reply