Panel: Add a logo to config / understanding the Reference

How can i add a logo?

  • Logo is in the root directory (where the yaml is)
  • Tried different path formats like “logo_horizontal.png” “./logo_horizontal.png” ““file://C:\projects\lumen\logo_horizontal.png””

How my config looks:

config:
  title: Palmer Penguins
  theme: dark
  logo: logo_horizontal.png

The error i get:
AttributeError: 'Config' object has no attribute 'config'

The reference isn’t very helpful IMAHO

  • it specifies only “string”
  • it has no example (yaml)

In general: How to read the reference?

  • it is python code not yaml
  • E.g. for theme:, it’s specifing panel.template.DarkTheme is a valid input, how can i translate that to the (apparently) valid dark

I read my config file using omegaconf:

from omegaconf import DictConfig, OmegaConf
cfg = OmegaConf.load(config_file)

Here’s how I added logo. In your case probably logo=f"{pwd}/{cfg.logo}" will work:

pwd = f"{os.path.dirname(__file__)}"
pn.template.FastListTemplate(
            title=cfg.title,
            favicon=f"{pwd}/assets/favicon.png",
            logo=f"{pwd}/assets/favicon.png",
            main=[...],
            main_layout=None,
        )

I hope it helps.