Default map canvas color based on theme color palette
This PR adds the option to have the background color of the map canvas determined by the current theme:
- In the "Night Mapping" theme, this prevents glaring map canvas in new projects
- This setting only refers to the default setting in the profile when creating new projects
- Existing projects are not affected by this change
- Affects all map views 2D and 3D
Before:
After:
Result:
🪟 Windows builds ready!
Windows builds of this PR are available for testing here. Debug symbols for this build are available here.
(Built from commit 81a079fa5bd34fe87f84a7c89fd10e02c32514c7)
@fiddlersfan , hey, thanks for your efforts here. I've had the time to think about this a bit.
For me, I'm -1 to default to this new behavior. I don't think we should mix UI / OS appearance and the document itself. For e.g., in inkscape, if the app is in dark mode, you'll still get a blank white canvas. Same goes for word processors, etc.
If we would be to add this option but not default to it, it would then raise the following question: why not simply change the default white background color to a dark one manually. That'd be +/- the same amount of clicks :)
Thoughts?
@nirvn Thanks for taking up this pr again. I lost sight of this topic during the frozen period.
I can understand your reasoning regarding word processors and Inkscape. However, both examples are historically designed for paper-based documents and therefore have white as the default colour and a limited extent. If you take Blender, FreeCAD or GIMP as an example, the base canvas depends on the theme.
IMHO it boils down to the question of whether the map and 3d canvases shows a kind of document or objects in a coordinate-related space like in a 3D software.
Historically, QGIS has a fixed background color that is saved in the project. I would prefer a map background to be optional so that the user can decide what they need. However, I am not sure whether this is possible without breaking changes. That's why I want to add this option. I don't have a strong opinion on whether this should be default or not.
why not simply change the default white background color to a dark one manually.
The background color is saved as a property in the project file. So if I adjust the background manually and a colleague opens the project, he also has a dark map canvas even though he is using the standard theme. This would actually mix the UI and the project content.
Just as an addendum: I wouldn't think of using anything other than white as the background color for the paper-like view in the layout view.
@fiddlersfan @nirvn
Here's an alternative idea -- allow a transparent / not set color for the background setting. If the project color is not set (invalid), then QgsMapCanvas would replace it with the widget's palette window color instead when setting up its QgsMapSettings object.
The default would remain as a white color, but you could then go and change that to "no color" in order to indicate that the project should effectively be background-less.
@nyalldawson , +1 for opt in no color. It would also make for a nicer UI as our color button widget already has a no color mode.
@nyalldawson Thanks, sounds like the best solution for me
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
-
that all unit tests are passing
-
that all comments by reviewers have been addressed
-
that there is enough information for reviewers, in particular
-
link to any issues which this pull request fixes
-
add a description of workflows which this pull request fixes
-
add screenshots if applicable
-
-
that you have written unit tests where possible In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this pull request. If there is no further activity on this pull request, it will be closed in a week.
While we hate to see this happen, this PR has been automatically closed because it has not had any activity in the last 21 days. If this pull request should be reconsidered, please follow the guidelines in the previous comment and reopen this pull request. Or, if you have any further questions, just ask! We love to help, and if there's anything the QGIS project can do to help push this PR forward please let us know how we can assist.