It is possible to change the font size of a template? I’ve tried the following, but it raises an error.
import panel
import param
panel.extension()
from panel.template import VanillaTemplate
from panel.template.vanilla import VanillaDarkTheme
class MyTheme(VanillaDarkTheme):
# trying to load a custom css file
css = param.Filename(default='custom.css')
vanilla = VanillaTemplate(title="My title", theme=MyTheme)
vanilla.show()
I found a way:
import panel
import param
CUSTOM_CSS = """
#header {padding: 0}
.title {
font-size: 1em;
font-weight: bold;
padding-left: 10px;
}
"""
CUSTOM_CSS_NO_HEADER = """
#header {display: none}
"""
# This doesn't work
# panel.extension(raw_css=[CUSTOM_CSS])
panel.extension()
from panel.template import VanillaTemplate
from panel.template.vanilla import VanillaDarkTheme
vanilla = VanillaTemplate(title="My title", theme=VanillaDarkTheme)
vanilla.config.raw_css.append(CUSTOM_CSS)
vanilla.show()
3 Likes