Kiawe's source is correct. I just checked Diamond (Gen 4) and Ruby (Gen 3) on GBA & DS emulators. It isn't possible until Black/White.
The form difference section will now show Shiny Pokémon as well as
form differences. The last sprite selected will become the one
displayed in the main entry.
List (Main Series)
Black/White
Black 2/White 2
X/Y
Omega Ruby/Alpha Sapphire
Sun/Moon
Ultra Sun/Ultra Moon
Let's Go, Eevee!/Let's Go, Pikachu!
Sword/Shield
Brilliant DIamond/Shining Pearl
Legends: Arceus
Scarlet/Violet
Source
Up to date as of December 28th, 2023