When opening the docs, there's a flash of dark mode before it switches, following #2820. Would it be possible to default to system colors, and use custom ones as a fallback? That should fix it.
Tailwind's docs about it are here. I don't love that solution, but 🤷♂