I'd rather bind Scene.getPreferences().colorSchemeProperty() to a
central toggle, which could be a global singleton, or available with
dependency injection at the point where you construct the Scene.


On Fri, Apr 17, 2026 at 11:57 AM Marius Hanl <[email protected]> wrote:
>
> Hi all,
>
> I was wondering what the best way would be to override the Color Scheme
> in the application to not use the one from the OS. This is often needed
> for a toggle to manually change between the Light <-> Dark color scheme.
>
> The current solution is to iterate over Window.getWindows() and call
> scene.getPreferences().setColorScheme(..).
> Or call setColorScheme(null) to use the OS preference again.
>
> This seems fine, but I wonder if there is a better way or I may miss
> something?
>
> -- Marius

Reply via email to