https://github.com/jo-tools/app-appearance
Xojo example project: App Appearance
https://github.com/jo-tools/app-appearance
darkmode declares macos windows xojo
Last synced: over 1 year ago
JSON representation
Xojo example project: App Appearance
- Host: GitHub
- URL: https://github.com/jo-tools/app-appearance
- Owner: jo-tools
- License: mit
- Created: 2022-02-04T21:41:20.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-08T21:51:26.000Z (over 1 year ago)
- Last Synced: 2025-03-08T22:25:30.272Z (over 1 year ago)
- Topics: darkmode, declares, macos, windows, xojo
- Language: Xojo
- Homepage: https://www.jo-tools.ch
- Size: 3.9 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# App Appearance
Xojo example project
[](LICENSE)
## Description
An example Xojo project to show how to deal with Xojo's DarkMode Support to customize the application's appearance on macOS and Windows.
### macOS
macOS 10.14 has introduced DarkMode. Xojo just provides a Build Setting ```Supports DarkMode```. The built application will then appear in Dark- or Lightmode, according to the current system setting.
This example project shows how to override this, so that your application can provide a user preference allowing the application to appear in ```Always Dark```, ```Always Light``` - or of course the ```System Default```.
### Windows
DarkMode on Windows is... not that good - at least not for Win32 Apps/Controls, which is what Xojo is currently using. For that reason it is best practice to explizitly allow the user to ```Opt-in``` for DarkMode support of your application. Many Windows users love to have their system setting to have dark appearance in apps, but might dislike that in Win32-apps.
Starting with Xojo 2021r3, Xojo supports DarkMode for ```TargetWindows```. This example project shows how to allow the users to ```Opt-in``` for DarkMode support, because Xojo by default always uses the system settings.
*Note: Unlike macOS, you can never have the application show in DarkMode on Windows if 'app appearance setting' is 'Light Mode'.*
### ScreenShots
macOS in DarkMode, but application in ```Always Light```

macOS in LightMode, but application in ```Always Dark```

Windows in DarkMode and user's app-preference: ```DarkMode Opt-in: no```, so application will appear in ```Light```

Windows in DarkMode and user's app-preference: ```DarkMode Opt-in: yes```, so application will appear in ```Dark```

## Xojo
### Requirements
[Xojo](https://www.xojo.com/) is a rapid application development for Desktop, Web, Mobile & Raspberry Pi.
The Desktop application Xojo example project ```AppAppearance.xojo_project``` is using:
- Xojo 2024r4.2
- API 2
*Note: You'll need to build with Xojo 2021r3 or later to get DarkMode Support on TargetWindows*
### How to use in your own Xojo project?
1. Copy the Module ```modAppAppearance``` from the example project, and paste it into your project.
2. Study the example project to learn how to use the provided methods in the Module.
- Windows: The Opt-In happens in ```App.Open```: ```Windows_DarkMode_OptIn = true|false```
- macOS: You can switch the appearance any time. See actions in the corresponding ```PushButtons```, e.g.: ```macOSAppAppearance = NSAppearanceType.Light|Dark|Default```
## About
Juerg Otter is a long term user of Xojo and working for [CM Informatik AG](https://cmiag.ch/). Their Application [CMI LehrerOffice](https://cmi-bildung.ch/) is a Xojo Design Award Winner 2018. In his leisure time Juerg provides some [bits and pieces for Xojo Developers](https://www.jo-tools.ch/).
### Contact
[](mailto:xojo@jo-tools.ch)
[](https://www.facebook.com/juerg.otter)
[](https://twitter.com/juergotter)
### Donation
Do you like this project? Does it help you? Has it saved you time and money?
You're welcome - it's free... If you want to say thanks I'd appreciate a [message](mailto:xojo@jo-tools.ch) or a small [donation via PayPal](https://paypal.me/jotools).
[](https://paypal.me/jotools)