And the current rehype-pretty-code documentation seems to imply that the theme keys (--shiki-light and --shiki-light-bg in this example) are added to the \ element:
However, I only see that the theme keys are added to the \ elements, which also seems to match with my short read of the source code with the theme keys only added on the \ elements.
Unless I'm missing something, the fix needed is to add the theme keys to \
, \, or even \ (to include \) so it's possible to set the background color of the code block based on the theme.
The Shiki dual-themes documentation shows that it adds theme keys to the \