Render Flow - Theme switching architecture
Load HTML
→Load CSS variables for default theme
User clicks theme switch button
→JavaScript toggles theme class on <body>
Browser repaints with new colors
The browser first loads the page with default theme colors set by CSS variables. When the user switches theme, JavaScript changes a class on the body, updating CSS variables to new colors. The browser then repaints the page with the new theme colors.