Skip to content

Commit a2a6554

Browse files
start theme with plotly
1 parent 4fcf29d commit a2a6554

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

quarto/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
from quarto.quarto import path
77
from quarto.render import render
88
from quarto.metadata import metadata
9+
from quarto.theme import plotly_theme_colors, plotly_theme_brand

quarto/theme.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import yaml
2+
import plotly.graph_objects as go
3+
from functools import partial
4+
5+
def plotly_theme_colors(bg, fg):
6+
return go.layout.Template({'layout': {
7+
'paper_bgcolor': bg,
8+
'plot_bgcolor': bg,
9+
'font_color': fg,
10+
}})
11+
12+
def plotly_theme_brand(brand_yml):
13+
brand = yaml.safe_load(open(brand_yml).read())
14+
return plotly_theme_colors(brand["color"]["background"], brand["color"]["foreground"])

0 commit comments

Comments
 (0)