When loading a page with dark mode turned on, a light theme is visible for a while before the previously selected dark theme is applied.
Yes
A dark theme should be shown right away
For a second or so, a "regular" light theme is showed, and only then a dark theme:

Yeah we're aware of this issue. It's because the theme is only applied after page load, that's why we see the flash. It's a little annoying but possible to fix - gatsbyjs.org doesn't have this issue.
A good example where there is no such issue - https://overreacted.io/ (yeah, powered by Gatsby).
Try reading this https://github.com/donavon/use-dark-mode/blob/develop/README.md#that-flash
To fix this, we need a setbody hooks to inject script into html body. So that it wont wait till React load to actually enter dark mode
Most helpful comment
Try reading this https://github.com/donavon/use-dark-mode/blob/develop/README.md#that-flash
To fix this, we need a setbody hooks to inject script into html body. So that it wont wait till React load to actually enter dark mode