How to set selected icon for toolWindow (new UI)?

Selected icon (e.g. GitHub copilot which is gray when not selected):

You can only specify icon attribute for toolWindow in plugin.xml?

Or is this done dynamically in ToolWindowFactory? Code example?

Might have found something: Working with Icons | IntelliJ Platform Plugin SDK

The “selected” icon is computed dynamically by changing some particular colors. This change has been introduced with the New UI.
This works because IDE icons are gray-colored. Globally, some predefined gray-colors are replaced by white, and white is replaced by a gray color. The blue background color is defined by the IDE theme.
I don’t remember the exact set of gray colors, but you can find them in IntelliJ Community’s sources.

That also means colored icons (per example blue icons) provided by third-party plugins are poorly integrated with the New UI, unless you define a custom theme (but this is another story ^_^).