|
23 | 23 | from typing import Any, List |
24 | 24 |
|
25 | 25 | import plotly.graph_objects as go |
26 | | -import plotly.io as pio |
27 | 26 |
|
28 | 27 |
|
29 | 28 | class ButtonManager: |
@@ -411,14 +410,45 @@ def add_theme_toggle_button( |
411 | 410 | y : float, optional |
412 | 411 | Y position of the button (0-1), by default 1.02. |
413 | 412 | """ |
414 | | - # Light theme with light button styling for all updatemenus |
| 413 | + # Define light theme properties manually to avoid JSON serialization issues |
| 414 | + # Use dot notation to target specific properties without overriding the entire scene |
| 415 | + # Colors extracted from official plotly template |
415 | 416 | light_theme = { |
416 | | - "template": pio.templates["plotly"] |
| 417 | + "paper_bgcolor": "white", |
| 418 | + "plot_bgcolor": "#E5ECF6", |
| 419 | + "font.color": "#2a3f5f", |
| 420 | + "scene.xaxis.backgroundcolor": "#E5ECF6", |
| 421 | + "scene.xaxis.gridcolor": "white", |
| 422 | + "scene.xaxis.linecolor": "white", |
| 423 | + "scene.xaxis.zerolinecolor": "white", |
| 424 | + "scene.yaxis.backgroundcolor": "#E5ECF6", |
| 425 | + "scene.yaxis.gridcolor": "white", |
| 426 | + "scene.yaxis.linecolor": "white", |
| 427 | + "scene.yaxis.zerolinecolor": "white", |
| 428 | + "scene.zaxis.backgroundcolor": "#E5ECF6", |
| 429 | + "scene.zaxis.gridcolor": "white", |
| 430 | + "scene.zaxis.linecolor": "white", |
| 431 | + "scene.zaxis.zerolinecolor": "white" |
417 | 432 | } |
418 | 433 |
|
419 | | - # Dark theme with dark button styling for all updatemenus |
| 434 | + # Define dark theme properties manually |
| 435 | + # Colors extracted from official plotly_dark template |
420 | 436 | dark_theme = { |
421 | | - "template": pio.templates["plotly_dark"] |
| 437 | + "paper_bgcolor": "rgb(17,17,17)", |
| 438 | + "plot_bgcolor": "rgb(17,17,17)", |
| 439 | + "font.color": "#f2f5fa", |
| 440 | + "scene.xaxis.backgroundcolor": "rgb(17,17,17)", |
| 441 | + "scene.xaxis.gridcolor": "#506784", |
| 442 | + "scene.xaxis.linecolor": "#506784", |
| 443 | + "scene.xaxis.zerolinecolor": "#C8D4E3", |
| 444 | + "scene.yaxis.backgroundcolor": "rgb(17,17,17)", |
| 445 | + "scene.yaxis.gridcolor": "#506784", |
| 446 | + "scene.yaxis.linecolor": "#506784", |
| 447 | + "scene.yaxis.zerolinecolor": "#C8D4E3", |
| 448 | + "scene.zaxis.backgroundcolor": "rgb(17,17,17)", |
| 449 | + "scene.zaxis.gridcolor": "#506784", |
| 450 | + "scene.zaxis.linecolor": "#506784", |
| 451 | + "scene.zaxis.zerolinecolor": "#C8D4E3" |
422 | 452 | } |
423 | 453 |
|
424 | 454 | # Add styling updates for all existing updatemenus |
|
0 commit comments