Windows dark mode in .NET 10 build#4594
Merged
Merged
Conversation
1ae44d9 to
2087fa6
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
2087fa6 to
6861cc4
Compare
This comment was marked as outdated.
This comment was marked as outdated.
653c148 to
a2c4771
Compare
d3899f2 to
52646bb
Compare
52646bb to
f2ab1a9
Compare
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Motivation
CKAN users on Windows want a dark mode. (Mono's WinForms implementation provides a dark mode automatically if the user's system theme is dark, so Linux users have had this all along.) We've provided some custom registry keys to make the old WinForms system colors dark, but it would be better if this was automatic and looked nicer, which the .NET 10 dark mode achieves.
Changes
Form.Closingevent is now replaced byFormClosing, so we've made that switchckan-windows.exefile, which is attached to commits as an artifact and uploaded to releases and S3 for dev builds.To make this work:
ckan-windows.execan only be built on Windows)test.ymlis now eliminated andbuild.ymlhandles both building and testing in one step for both platformsckan.exe, which will still be the net481 build, since theckan-windows.exebuild would need to replace itself with the latest version of that same buildckan-windows.execkan-windows.exebuild launches the GUI, if the registry keyHKEY_CURRENT_USER\SOFTWARE\Microsoft\CurrentVersion\Themes\Personalize\AppsUseLightThemeis set to a value other than1(which is controlled by the display settings dark mode option), then GUI will start in dark mode:ListViews with groups will have a somewhat lighter background than is the default in dark mode, to make the hard-coded-blue group headers readable:LinkLabels will use a newUtil.LinkColorForBackColor()function to set their text color to a blend of blue and white when the background is dark (the default is a harder-to-read blue)Important caveats
ckan-windows.exebuild, NOT theckan.exebuild!ckan.exeis built for .NET Framework 4.8.1, which does not have dark mode support for WinForms, but is possible to run with Mono, so this is the build that will be used for Linux.ckan-windows.exeis built for .NET 10, which does have dark mode support for WinForms, but is not possible to run with Mono.ckan.exeversion only (because this is already pre-determined and hard-coded by the code in the old releases), and they will have to downloadckan-windows.exeon their own(But once users are on the
ckan-windows.exetrack, the autoupdater should keep them on it.)Maybe we can figure out a smoother way to handle this in the future.
ckan-windows.exebuild uses single-file mode, but not self-contained or trimmed. This allows us to still ship just one file (I do not want to receive support requests because somebody didn't copy one DLL out of fifty), but without it being 100+ MB.(The .NET Framework builds have always used ILRepack to produce one .exe file, but this does not work with .exe files on post-Framework .NET.)
Trimming would be nice to shrink the build further, but when I tried enabling it, there were some very thorny errors to fix related to how to avoid dropping dependencies that are accessed via reflection. Leaving this as a possible future project.