Skip to content

[BUG]: Modebar hover colors remain stale after color/activecolor updates when switching themes #8023

Description

@Lexachoc

Description

Theme switching is a very common use case. Because of this bug, modebar buttons can become nearly invisible after switching from a light theme to a dark theme.

Modebar button hover colors do not update correctly when layout.modebar.color or layout.modebar.activecolor changes after the plot has already been rendered.

For example, when switching a plot between light and dark themes:

  1. Render the plot in the light theme.
  2. Update layout.modebar.color and layout.modebar.activecolor to the corresponding dark theme values.
  3. The modebar initially appears correct with the updated colors.
  4. Hover over any modebar button.
  5. The hovered button uses the colors from the initial light-theme render instead of the current dark theme values.

The reverse also happens when the plot is initially rendered in the dark theme and then switched to the light theme.

In other words, the non-hover state updates correctly after the layout changes, but the hover state appears to retain the initial values of color and
activecolor. layout.modebar.bgcolor appears to update correctly; the issue seems specific to color and activecolor.

This is also reproducible in Plotly's own examples when dynamically switching themes.

Expected behavior

Modebar buttons should use the latest values of layout.modebar.color and layout.modebar.activecolor after the layout is updated.

Screenshots/Video

  • See below

Steps to reproduce

The hovered button becomes darker, as expected:
Image

  • Switch the documentation site to the dark theme:
Image
  • Return to the plot. Before hovering over the modebar buttons, the modebar colors appear correct for the dark theme:
Image
  • Now, hover over the modebar buttons. The icon colors switch back to the stale values from the initial light theme render instead of using the current dark theme color and activecolor values!

    The behavior can be seen clearly in this recording:

PixPin_2026-09-05_23-48-34.mp4

Activity

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

    bugsomething broken

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions