Skip to content

Code blocks flashes in dark mode #11566

Open

Description

@carolyn-sun

Have you read the Contributing Guidelines on issues?

Prerequisites

Description

When loading a Docusaurus page in dark mode, code blocks briefly flash with light theme colours before switching to the correct dark theme colours. This creates a jarring visual experience.

Reproducible demo

Can reproduce on any official page, https://docusaurus.io/docs/configuration

Steps to reproduce

  1. Configure Docusaurus with both light and dark Prism themes.
prism: {
  theme: prismThemes.oneLight,
  darkTheme: prismThemes.oneDark,
},
  1. Switch the site to dark mode
  2. Navigate to any page with code blocks
  3. Observe the code blocks during loading

Expected behavior

Code blocks should immediately display with the dark theme colours when the page loads in dark mode.

Actual behavior

Code blocks briefly display with light theme colours (a white background and light syntax highlighting), then quickly switch to dark theme colours. This flash is very noticeable and disrupts the user experience.

Your environment

N/A

Self-service

  • I'd be willing to fix this bug myself.

Activity

  1. added
    bug
    status: needs triage
    on Nov 22, 2025
  2. added
    external
    and removed
    status: needs triage
    on Nov 22, 2025
  3. slorber commented on Nov 22, 2025

    @slorber
    Collaborator

    This is a known issue that is related to how our syntax highlighting dependency works: FormidableLabs/prism-react-renderer#149

    Since we don't have any Docusaurus issues open about this topic, I'll keep this one open, although we can't really do anything apart from changing the highlighter (which would be a breaking change), or provide support for an alternative one.

    Related to:

  4. FranEzeNegri commented on Apr 21, 2026

    @FranEzeNegri
  5. added 2 commits that reference this issue on Jul 2, 2026
    f85cce9
    3389bd9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugexternal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions