Currently, the two themes shipped with JavaFX (Caspian and Modena) are implemented as a set of stylesheets and some internal logic, mostly in `PlatformImpl`.
Much of this logic deals with optional features or platform-specific theme modifications. Another piece of logic deals with accessibility themes: on Windows platforms, both Caspian and Modena have high-contrast stylesheets that are added or removed in response to OS theme changes.
A major downside of this implementation is that it special-cases the built-in themes and doesn't offer enough extension points to make it easy for developers to create new rich themes. A first-class theme API should be added to JavaFX that allows developers to extend the built-in themes, and create new themes that can respond to OS-level preferences like dark mode or accent colors.