Skip to content

Commit dbc8724

Browse files
pygal
1 parent a75ca65 commit dbc8724

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

quarto/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
matplotlib_theme_colors, matplotlib_theme_brand, \
1313
plotnine_theme_colors, plotnine_theme_brand, \
1414
plotly_theme_colors, plotly_theme_brand, \
15+
pygal_theme_colors, pygal_theme_brand, \
1516
seaborn_theme_colors, seaborn_theme_brand

quarto/theme.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,29 @@ def plotly_theme_brand(brand_yml):
113113
return plotly_theme_colors(brand["color"]["background"], brand["color"]["foreground"])
114114

115115

116+
def pygal_theme_colors(_bg, fg, primary, secondary):
117+
from pygal.style import Style
118+
return Style(
119+
background='transparent',
120+
plot_background='transparent',
121+
foreground=fg,
122+
foreground_strong=primary,
123+
foreground_subtle=secondary or '#630C0D',
124+
opacity='.6',
125+
opacity_hover='.9',
126+
transition='400ms ease-in',
127+
colors=('#E853A0', '#E8537A', '#E95355', '#E87653', '#E89B53'))
128+
129+
def pygal_theme_brand(brand_yml):
130+
brand = yaml.safe_load(open(brand_yml).read())
131+
return pygal_theme_colors(
132+
brand["color"]["background"],
133+
brand["color"]["foreground"],
134+
brand["color"]["primary"],
135+
brand["color"].get("secondary"),
136+
)
137+
138+
116139
def seaborn_theme_colors(bg, fg):
117140
# seaborn accepts matplotlib rcparams
118141
return {

0 commit comments

Comments
 (0)