11import yaml
22from functools import partial
33
4- def altair_theme_colors (bg , fg ):
4+ def theme_colors_altair (bg , fg ):
55 return {
66 'config' : {
77 'view' : {'stroke' : 'transparent' },
@@ -18,14 +18,14 @@ def altair_theme_colors(bg, fg):
1818 }
1919 }
2020
21- def altair_theme_brand (brand_yml ):
21+ def theme_brand_altair (brand_yml ):
2222 brand = yaml .safe_load (open (brand_yml ).read ())
2323 bg = brand ["color" ]["background" ]
2424 fg = brand ["color" ]["foreground" ]
25- return partial (altair_theme_colors , bg , fg )
25+ return partial (theme_colors_altair , bg , fg )
2626
2727# background fill is incomplete
28- def bokeh_theme_colors (bg , fg ):
28+ def theme_colors_bokeh (bg , fg ):
2929 from bokeh .io import curdoc
3030 from bokeh .themes import Theme
3131 curdoc ().theme = Theme (json = {'attrs' : {
@@ -43,26 +43,26 @@ def bokeh_theme_colors(bg, fg):
4343 },
4444 }})
4545
46- def bokeh_theme_brand (brand_yml ):
46+ def theme_brand_bokeh (brand_yml ):
4747 brand = yaml .safe_load (open (brand_yml ).read ())
4848 fg = brand ["color" ]["foreground" ]
4949 bg = brand ["color" ]["background" ]
50- return partial (bokeh_theme_colors , bg , fg )
50+ return partial (theme_colors_bokeh , bg , fg )
5151
5252
53- def great_tables_theme_colors (bg , fg ):
53+ def theme_colors_great_tables (bg , fg ):
5454 return {
5555 'table_background_color' : bg ,
5656 'table_font_color' : fg
5757 }
58- def great_tables_theme_brand (brand_yml ):
58+ def theme_brand_great_tables (brand_yml ):
5959 brand = yaml .safe_load (open (brand_yml ).read ())
6060 fg = brand ["color" ]["foreground" ]
6161 bg = brand ["color" ]["background" ]
62- return great_tables_theme_colors (bg , fg )
62+ return theme_colors_great_tables (bg , fg )
6363
6464
65- def matplotlib_theme_colors (bg , fg , primary ):
65+ def theme_colors_matplotlib (bg , fg , primary ):
6666 import matplotlib as mpl
6767 from cycler import cycler
6868 mpl .rcParams ["axes.facecolor" ] = bg
@@ -78,42 +78,42 @@ def matplotlib_theme_colors(bg, fg, primary):
7878 mpl .rcParams ["axes.prop_cycle" ] = cycler ('color' , [primary ])
7979
8080
81- def matplotlib_theme_brand (brand_yml ):
81+ def theme_brand_matplotlib (brand_yml ):
8282 brand = yaml .safe_load (open (brand_yml ).read ())
8383 return partial (
84- matplotlib_theme_colors ,
84+ theme_colors_matplotlib ,
8585 brand ["color" ]["background" ],
8686 brand ["color" ]["foreground" ],
8787 brand ["color" ]["primary" ],
8888 )
8989
9090
91- def plotnine_theme_colors (bg , fg ):
91+ def theme_colors_plotnine (bg , fg ):
9292 from plotnine import theme , element_rect , element_text
9393 return theme (
9494 plot_background = element_rect (fill = bg , size = 0 ),
9595 text = element_text (color = fg )
9696 )
9797
98- def plotnine_theme_brand (brand_yml ):
98+ def theme_brand_plotnine (brand_yml ):
9999 brand = yaml .safe_load (open (brand_yml ).read ())
100- return plotnine_theme_colors (brand ["color" ]["background" ], brand ["color" ]["foreground" ])
100+ return theme_colors_plotnine (brand ["color" ]["background" ], brand ["color" ]["foreground" ])
101101
102102
103- def plotly_theme_colors (bg , fg ):
103+ def theme_colors_plotly (bg , fg ):
104104 import plotly .graph_objects as go
105105 return go .layout .Template ({'layout' : {
106106 'paper_bgcolor' : bg ,
107107 'plot_bgcolor' : bg ,
108108 'font_color' : fg ,
109109 }})
110110
111- def plotly_theme_brand (brand_yml ):
111+ def theme_brand_plotly (brand_yml ):
112112 brand = yaml .safe_load (open (brand_yml ).read ())
113- return plotly_theme_colors (brand ["color" ]["background" ], brand ["color" ]["foreground" ])
113+ return theme_colors_plotly (brand ["color" ]["background" ], brand ["color" ]["foreground" ])
114114
115115
116- def pygal_theme_colors (_bg , fg , primary , secondary ):
116+ def theme_colors_pygal (_bg , fg , primary , secondary ):
117117 from pygal .style import Style
118118 return Style (
119119 background = 'transparent' ,
@@ -126,17 +126,17 @@ def pygal_theme_colors(_bg, fg, primary, secondary):
126126 transition = '400ms ease-in' ,
127127 colors = ('#E853A0' , '#E8537A' , '#E95355' , '#E87653' , '#E89B53' ))
128128
129- def pygal_theme_brand (brand_yml ):
129+ def theme_brand_pygal (brand_yml ):
130130 brand = yaml .safe_load (open (brand_yml ).read ())
131- return pygal_theme_colors (
131+ return theme_colors_pygal (
132132 brand ["color" ]["background" ],
133133 brand ["color" ]["foreground" ],
134134 brand ["color" ]["primary" ],
135135 brand ["color" ].get ("secondary" ),
136136 )
137137
138138
139- def seaborn_theme_colors (bg , fg ):
139+ def theme_colors_seaborn (bg , fg ):
140140 # seaborn accepts matplotlib rcparams
141141 return {
142142 "axes.facecolor" : bg ,
@@ -151,6 +151,6 @@ def seaborn_theme_colors(bg, fg):
151151 "grid.color" : fg ,
152152 }
153153
154- def seaborn_theme_brand (brand_yml ):
154+ def theme_brand_seaborn (brand_yml ):
155155 brand = yaml .safe_load (open (brand_yml ).read ())
156- return seaborn_theme_colors (brand ["color" ]["background" ], brand ["color" ]["foreground" ])
156+ return theme_colors_seaborn (brand ["color" ]["background" ], brand ["color" ]["foreground" ])
0 commit comments