Skip to content

Commit a240314

Browse files
bokeh
1 parent 10a27de commit a240314

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

quarto/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
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, altair_theme_colors, altair_theme_brand
9+
from quarto.theme import plotly_theme_colors, plotly_theme_brand, \
10+
altair_theme_colors, altair_theme_brand, \
11+
bokeh_theme_colors, bokeh_theme_brand

quarto/theme.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,28 @@ def altair_theme_brand(brand_yml):
3434
brand = yaml.safe_load(open(brand_yml).read())
3535
bg = brand["color"]["background"]
3636
fg = brand["color"]["foreground"]
37-
return partial(altair_theme_colors, bg, fg)
37+
return partial(altair_theme_colors, bg, fg)
38+
39+
def bokeh_theme_colors(bg, fg):
40+
from bokeh.io import curdoc
41+
from bokeh.themes import Theme
42+
curdoc().theme = Theme(json={'attrs': {
43+
'figure': {
44+
'background_fill_color': bg, # just plot area
45+
},
46+
'Title': {
47+
'background_fill_color': bg,
48+
'text_color': fg,
49+
},
50+
'Axis': {
51+
'background_fill_color': bg,
52+
'axis_label_text_color': fg,
53+
'major_label_text_color': fg,
54+
},
55+
}})
56+
57+
def bokeh_theme_brand(brand_yml):
58+
brand = yaml.safe_load(open(brand_yml).read())
59+
fg = brand["color"]["foreground"]
60+
bg = brand["color"]["background"]
61+
return partial(bokeh_theme_colors, bg, fg)

0 commit comments

Comments
 (0)