comaps/url-processor
21
4
Fork
You've already forked url-processor
1

Make map style follow system theme preference #36

Merged
hbond merged 3 commits from :auto-map-style into master 2025年07月31日 22:20:06 +02:00
Contributor
Copy link

Uses the fiord OpenFreeMap style on system dark mode. I didn't use the dark style because it has almost no detail so it can be difficult to see map features.
Having been flashbanged by the Organic Maps equivalent of this map before, this will be a definite improvement for use at night :)

Also renames a variable from kSharedViaOM to kSharedViaCM since I noticed it while working on this

Uses the fiord OpenFreeMap style on system dark mode. I didn't use the dark style because it has almost no detail so it can be difficult to see map features. Having been flashbanged by the Organic Maps equivalent of this map before, this will be a definite improvement for use at night :) Also renames a variable from `kSharedViaOM` to `kSharedViaCM` since I noticed it while working on this
hbond requested changes 2025年07月31日 20:06:39 +02:00
Dismissed
hbond left a comment
Copy link

thanks it's a great idea! i think it'd be better to use an event listener instead of a looping check (see comment)

thanks it's a great idea! i think it'd be better to use an event listener instead of a looping check (see comment)
public/ge0.html Outdated
@ -243,1 +243,4 @@
let theme;
setInterval(() => {
Owner
Copy link

Instead of checking every 10 ms, let's use an event listener:

something like

window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
 const darkStyle = 'https://tiles.openfreemap.org/styles/fiord';
 const lightStyle = 'https://tiles.openfreemap.org/styles/bright';
 map.setStyle(event.matches ? darkStyle : lightStyle);
});

(https://stackoverflow.com/a/57795495)

It should be more performant, and we won't need the separate theme var either :)

Instead of checking every 10 ms, let's use an event listener: something like ```js window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => { const darkStyle = 'https://tiles.openfreemap.org/styles/fiord'; const lightStyle = 'https://tiles.openfreemap.org/styles/bright'; map.setStyle(event.matches ? darkStyle : lightStyle); }); ``` (https://stackoverflow.com/a/57795495) It should be more performant, and we won't need the separate theme var either :)
Author
Contributor
Copy link

Thanks for the feedback, implemented in e24b281f93

Thanks for the feedback, implemented in e24b281f93
cirilla marked this conversation as resolved
hbond left a comment
Copy link

Thanks! working perfectly

Thanks! working perfectly
cirilla deleted branch auto-map-style 2025年07月31日 22:28:01 +02:00
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
comaps/url-processor!36
Reference in a new issue
comaps/url-processor
No description provided.
Delete branch ":auto-map-style"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?