Skip to content

Fixed theme flicker#118

Merged
sergeychernyshev merged 10 commits intomainfrom
fix-theme-flicker
Feb 9, 2026
Merged

Fixed theme flicker#118
sergeychernyshev merged 10 commits intomainfrom
fix-theme-flicker

Conversation

@sergeychernyshev
Copy link
Copy Markdown
Member

@sergeychernyshev sergeychernyshev commented Feb 7, 2026

Removed theme flicker by switching default theme selection to use CSS.

Also moved theme-override attribute to be cookie-based so we can apply it on the server to avoid flicker when theme is overriden.

Moved nav bg style setting to a theme variable as well.

Closes #115

This PR were created with 🔵 AI-assistance from Gemini.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses UI theme flicker by making the default theme selection CSS-driven (via prefers-color-scheme) and by persisting an explicit user theme override in a cookie so it can be applied during SSR.

Changes:

  • Switch default theme variables to CSS prefers-color-scheme to avoid initial JS-driven theme swapping.
  • Persist theme override via theme-override cookie and render data-theme-override on the server.
  • Move TopNav background color to a theme CSS variable (--nav-bg) and update the theme toggle icon behavior accordingly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
telescopetest-io/src/layouts/Layout.astro Applies data-theme-override from cookie at render-time; defines light/dark theme variables and prefers-color-scheme defaults (including --nav-bg).
telescopetest-io/src/components/TopNav.astro Updates nav background to var(--nav-bg); changes theme toggle UI and replaces localStorage persistence with cookie-based persistence.
telescopetest-io/astro.config.mjs Forces server output to enable SSR cookie reading for theme override.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread telescopetest-io/src/layouts/Layout.astro Outdated
Comment thread telescopetest-io/src/components/TopNav.astro Outdated
Comment thread telescopetest-io/src/components/TopNav.astro Outdated
Comment thread telescopetest-io/src/components/TopNav.astro
Comment thread telescopetest-io/src/components/TopNav.astro Outdated
Copilot AI review requested due to automatic review settings February 7, 2026 18:36
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread telescopetest-io/src/components/TopNav.astro
Comment thread telescopetest-io/src/components/TopNav.astro Outdated
Copilot AI review requested due to automatic review settings February 7, 2026 18:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread telescopetest-io/src/components/TopNav.astro Outdated
Copilot AI review requested due to automatic review settings February 7, 2026 19:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread telescopetest-io/src/layouts/Layout.astro Outdated
@sergeychernyshev sergeychernyshev merged commit ede62b3 into main Feb 9, 2026
4 checks passed
@sergeychernyshev sergeychernyshev deleted the fix-theme-flicker branch February 9, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web UI theme switching doesn't work until JS kicks in

3 participants