This can be done by adding an macOS plugin which has access to the whole AppKit API.
Then you can set the desired appearance there at runtime, for example:
NSApplication.shared.appearance = NSAppearance(named: .darkAqua)
For more information please see this StackOverflow question:
How to set dark mode for NSToolbar in macOS Catalyst app?
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: