Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme all buttons, checkboxes, groupboxes, and listboxes #3489

Merged
merged 1 commit into from
Dec 4, 2021

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Nov 28, 2021

Background

When Windows users ask for a dark theme, our answer has been to configure the WinForms system colors to be dark because the CKAN GUI obeys those colors. However, Microsoft decided to make these colors uneditable in recent versions of Windows.

One of my long-term TODO items has been to create a DarkTheme.reg file so Windows users could configure a dark theme even when their operating system does not allow them to access these settings. (I think I had previously tried to create a .theme file, but it didn't go very well.)

Problems

I started working on that reg file, and I made some progress, but some of the buttons, checkboxes, groupboxes, and listviews could not be fixed by tweaking the colors:

Expand for "before" screenshots

image

image

image

image

image

image

image

image

Causes

Changes

  • Now we set GroupBox.ForeColor to SystemColors.ControlText
  • Now our ThemedListView control replaces the few remaining plain ListViews
  • Now we set FlatStyle for all of our buttons and checkboxes
  • Now the GUI/DarkTheme.reg file in the CKAN repo contains dark theming registry keys for Windows. It is a text file with 2 bytes per character that regedit.exe uses for exports, I think UTF-16 format? Once this is merged, we can add a link to this file on the wiki/forum/Discord, and users clicking it would be prompted like this:
    image
    After they click Yes, restarting Windows will load the dark theme. It would be nice to host the file itself on the wiki as well, but the wiki can only host plain text content with no file extension, so adding it to the repo is the next best option.
  • The visible file path in the compatible game versions window now uses the OS's path separator instead of using / on Windows
Expand for "after" screenshots

image

image

image

image

image

image

image

image

@HebaruSan HebaruSan added Bug Something is not working as intended Enhancement New features or functionality GUI Issues affecting the interactive GUI Pull request Windows Issues specific for Windows labels Nov 28, 2021
@HebaruSan HebaruSan requested a review from DasSkelett November 28, 2021 00:15
@HebaruSan

This comment has been minimized.

@DasSkelett
Copy link
Member

Nice work!
Is there an easy way to revert the color changes in the registry again? I think that would be neat to have, some users might not like the colors (different tastes etc. etc.) and wish to go back to the default colors.

@HebaruSan HebaruSan force-pushed the fix/gui-win-theming branch from 507442f to 53dae24 Compare December 4, 2021 18:03
@HebaruSan
Copy link
Member Author

Is there an easy way to revert the color changes in the registry again? I think that would be neat to have, some users might not like the colors (different tastes etc. etc.) and wish to go back to the default colors.

Good point. I reverted my color settings to a saved version from before I started this and captured the same keys in GUI/DefaultTheme.reg, so we can provide a link to that as the "undo" button. In the process I noticed that none of the keys in the second group (HKCU\Control Panel\Desktop\Colors) are changed back even though my colors are back to normal, so I removed those from DarkTheme.reg as well.

Copy link
Member

@DasSkelett DasSkelett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes and Linux testing look good

@HebaruSan HebaruSan merged commit 18d5030 into KSP-CKAN:master Dec 4, 2021
@HebaruSan HebaruSan deleted the fix/gui-win-theming branch December 10, 2021 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended Enhancement New features or functionality GUI Issues affecting the interactive GUI Windows Issues specific for Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants