How to use echarts themes

Hi,

with st_echarts(), I can define theme like,
st_echarts(options=options, width=‘900px’, key=key, theme=‘light’)

but it seems there are only 3 themes (light, dark, white) I can use, how can I apply other themes like “roma” or “vintage”…

Thanks,
Jonny

Hey @johnnyzhi1983,

The only built-in themes for Apache Echarts are the original theme, the light theme, and the dark theme (check out the Apache doc on Echarts themes here).

If you want to use a custom theme, you’d need to pass the style configuration as a Python dict to the st_echarts API (check out the README for the st_echarts component here).

@andfanilo any chance you have an example handy of what the style config Python dict should look like?

I don’t have one here under my hand, but as @Caroline stated I think I remember testing by selecting the roma/vintage theme and exporting a JSON from Theme Builder - Apache ECharts and read it as a Python dict in my script. You should be able to pass it in the theme argument then

Have a nice day,
Fanilo

1 Like