Header logo or title#

The header can show either a logo image or text, giving your documentation immediate branding. Swapping variants and tailoring light/dark mode versions is straightforward. The logo region spans roughly half the header width to fit even wide logos or names.

No logo (text only)#

Instead of an image you can display arbitrary text — commonly a project or organization name.

Set header text instead of logo

  1. In conf.py unset the logo: html_logo = None.

  2. Set text via html_title (default is <project> <release> documentation). If project = "Foo" and release is 1.0, the text becomes Foo 1.0 documentation.

    html_logo = None
    html_title = "My project"
    

Tip

Set the same project and HTML title:

project = html_title = "My Awesome Project"

Same logo for light and dark mode#

Use the standard Sphinx html_logo; the file appears in both modes.

Set a header logo

  1. In conf.py set html_logo to a path relative to conf.py or an external URL.

    html_logo = "logo.svg"
    

Different logo for light and dark mode#

If the light logo doesn’t look good against a dark background, supply a separate dark variant.

Set a dark mode logo

  1. Set the light variant with html_logo option.

  2. Set the dark variant using html_theme_options’s logo_dark option.

  3. Add the dark logo file (or its folder) to html_static_path so Sphinx copies it. (The light logo is copied automatically.)

For example:

html_static_path = ["_static"]
html_logo = "_static/logo.svg"
html_theme_options = {
      "logo_dark": "_static/logo-dark.svg"
}