There's a nice trick to switch between two images (one for light theme, another for dark theme). Use the <picture> tag.

Example from CyDo (via):

<picture>
	<source media="(prefers-color-scheme: dark)" srcset="docs/logo-banner-dark.webp">
	<source media="(prefers-color-scheme: light)" srcset="docs/logo-banner-light.webp">
	<img alt="CyDo — UI and orchestration for AI coding agents" src="docs/logo-banner-dark.webp" width="520">
</picture>