Skip to content

Commit

Permalink
Merge branch 'main' into add_last_messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuang11 authored Nov 27, 2024
2 parents ce48f3e + c6ac0a8 commit b539685
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions doc/how_to/styling/altair.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ from vega_datasets import data
pn.extension("vega")
def plot(theme, color):
alt.themes.enable(theme)
alt.theme.enable(theme)
return (
alt.Chart(data.cars())
Expand All @@ -41,7 +41,7 @@ def plot(theme, color):
.interactive()
)
themes = sorted(alt.themes.names())
themes = sorted(alt.theme.names())
theme = pn.widgets.Select(value="dark", options=themes, name="Theme")
color = pn.widgets.ColorPicker(value="#F08080", name="Color")
Expand All @@ -53,5 +53,5 @@ pn.Column(
).servable()
```

Please note that the line `alt.themes.enable(theme)` will set the theme of all future generated plots
Please note that the line `alt.theme.enable(theme)` will set the theme of all future generated plots
unless you specifically change it before usage in a `Vega` pane.
6 changes: 3 additions & 3 deletions doc/tutorials/basic/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ ACCENT = "teal"
image = pn.pane.JPG("https://assets.holoviz.org/panel/tutorials/wind_turbines_sunset.png")

if pn.config.theme=="dark":
alt.themes.enable("dark")
alt.theme.enable("dark")
else:
alt.themes.enable("default")
alt.theme.enable("default")

@pn.cache # Add caching to only download data once
def get_data():
Expand Down Expand Up @@ -153,7 +153,7 @@ Upon toggling, the app should switch to dark mode:
In the code:

- `pn.config.theme` determines the selected theme ("default" or "dark").
- `alt.themes.enable("dark")` applies the "dark" theme to the plot. Panel doesn't do this automatically.
- `alt.theme.enable("dark")` applies the "dark" theme to the plot. Panel doesn't do this automatically.
- `accent` sets the primary or accent color for the template, allowing quick branding of the app.
- `main_layout` specifies a layout to wrap each object in the main list. Choose from `"card"` (default) or `None`.

Expand Down

0 comments on commit b539685

Please sign in to comment.