Options¶
The theme options a site sets in html_theme_options in conf.py. Each is described the same
way: its type, its default and what it does.
A component list is a Python list of names, and a name may be written with or without .html.
These are the same:
html_theme_options = {
"footer_start": ["copyright", "sphinx-version"],
}
html_theme_options = {
"footer_start": ["copyright.html", "sphinx-version.html"],
}
Each name is a template. The theme looks for it in its own components/ directory first, then in
the site’s templates_path. A name that no template has draws nothing and raises no warning.
Components lists the ones the theme provides.
Layout¶
layout¶
Type: string
Default:
"hHh LpR lff"Meaning: The layout code. It places the header, the primary sidebar, the page, the secondary sidebar and the footer, and sets which of them stay in view while the page scrolls. An empty value means the default. A value that is not a layout code stops the build with a message naming the option. The layout code explains each letter.
Brand¶
The brand is the logo and name at the start of the navbar. When layout gives the top-left
corner to the primary sidebar, the brand heads that sidebar on wide screens and stays in the
navbar on narrow ones. A logo is a full address, a path starting _static/, or a path relative
to _static. Sphinx’s html_logo is used for both modes when logo gives no image.
logo¶
Type: dict
Default: empty
Meaning: The brand as a whole. Every key is optional:
text: the name beside the logo. Without it the site’s title is shown, unless the dict gives an image, and then no name is shown.image_lightandimage_dark: the logos for light and dark mode. The light logo is also shown in dark mode whenimage_darkis not set.alt_text: the logo’salttext. The default is the project name.link: where the brand leads. The default is the site’s home page.
Modes and themes¶
A reader sees the site in a mode: light, dark, or the one their system asks for. Each mode draws one daisyUI theme. The theme-switcher component lets a reader choose. Choose the themes shows the steps.
light_theme¶
Type: string
Default:
"light"Meaning: The theme the light mode draws. The name is used as given, so a theme of the site’s own works as well as one of daisyUI’s.
dark_theme¶
Type: string
Default:
"dark"Meaning: The theme the dark mode draws. The name is used as given.
default_mode¶
Type: string
Default:
"auto"Meaning: The mode a reader sees before they have chosen one. The values are
"auto", which follows the system’s setting,"light"and"dark". Any other value builds with a warning and means"auto". A reader’s own choice replaces it, and the browser remembers that choice.
theme_picker¶
Type: boolean, string or list of strings
Default: empty, which offers no theme by name
Meaning: The themes the theme menu lists besides the three modes.
Trueor"all"lists every theme the stylesheet holds. A list of names, or one string with the names separated by commas, lists those in the order given, each once. An empty value,Falseor"false"lists none. A name is accepted as given, so a site’s own theme can be named.
Moving between pages¶
show_prev_next¶
Type: boolean
Default:
TrueMeaning: Whether each page ends with links to the previous and the next page in the site’s table of contents. A page with neither, and the search and index pages, show none.
announcement¶
Type: text
Default: empty
Meaning: A banner across the top of every page. Text, including HTML of your own, is printed as written and is not escaped. Text that starts with
http://orhttps://is an address instead: the page script fetches it and puts the HTML it returns in the banner. The banner is removed when the address cannot be fetched, answers with an error or returns nothing, which includes a site opened from the file system. An empty value shows no banner.
Search¶
The theme draws a search button and a search dialog that list results from the index Sphinx writes. Set up search shows the steps.
search_bar_text¶
Type: string
Default:
"", which shows the words Search the docs in the reader’s languageMeaning: The words on the search button and in the dialog’s field. The text is shown as written, so markup in it appears as characters and is never read as HTML.
disable_search¶
Type: boolean
Default:
FalseMeaning: When
True, no page draws the search button or the dialog, and the keyboard shortcuts that open the dialog do nothing. Sphinx’s own search page is still built.
search_as_you_type¶
Type: boolean
Default:
TrueMeaning: Whether results are listed while the reader types. When
False, nothing is listed as they type, and Enter opens Sphinx’s full search page with their words.
Versions¶
The theme draws a version menu in the header when a site names the file that lists its versions. Set up versions shows the steps.
switcher¶
Type: dictionary with
json_urlandversion_matchDefault:
{}, which draws no menu and no bannerMeaning:
json_urlis where the file listing every version is.version_matchis the version this build documents. It labels the menu and picks the entry the reader is on. The menu is drawn on every page only whenjson_urlis set.
json_url takes three forms:
A full address, such as
https://example.org/switcher.json, or one starting with//, which is read ashttps:.A path from the server’s root, such as
/switcher.json.Any other path, such as
_static/switcher.json, which is read from the site’s root.
A version’s url in the file takes the same three forms. A path from the server’s root is
used as given, and any other path is read from the site’s root, so one file serves a page at any
depth. The check described under check_switcher reads a path in json_url from the build’s
output, where a path from the server’s root is read as from the site’s root.
check_switcher¶
Type: boolean
Default:
TrueMeaning: Whether the build reads the file at
json_urlonce, at the end of the build, and warns when it cannot be read or is not a list of versions each with aversionand aurl. The build still succeeds. A path is read from the built site, so a file in a static directory is found after the build copies it. WhenFalse, the file is never read.
Header links¶
The navbar-nav component draws a link to each top-level page of the site’s table of contents,
and to each of external_links, in the header.
external_links¶
Type: list of dicts
Default: empty
Meaning: Links to other sites, drawn by
navbar-navafter the site’s own sections. Each dict has aname, which is the link’s text, and aurl. A dict with nourlis left out. Each link is marked as leading outside the site.
header_links_before_dropdown¶
Type: integer
Default:
5Meaning: How many header links are shown before the rest go into a menu. Zero puts every link in the menu, and a number at or above the number of links draws no menu.
header_dropdown_text¶
Type: text
Default: empty, which shows “More” in the site’s language
Meaning: The label of the menu that holds the links past
header_links_before_dropdown.
Icon links¶
The navbar-icon-links component draws a link for each entry of icon_links, as an icon.
icon_links¶
Type: list of dicts
Default: empty
Meaning: The accounts and sites to link as icons. Each dict has these keys:
url: where the link leads. A dict with nourlis left out.name: the link’s accessible name and its tooltip. Without one, theurlis the name.icon: the icon the link is drawn with. With notype, it is the name of one of the icons listed below. Withtypeset tourl, it is the address of an image. Withtypeset tolocal, it is the address of an image, a path starting_static/, or a path relative to_static, and every page points at the file from its own depth.type:urlorlocalwheniconis an image. Any other value, or none, makesicona bundled icon’s name.
Warnings: The build warns once, with the warning type
daisyui.icon_links, when the option is given as text rather than a list, and once for each entry whoseiconis not a bundled icon. The warning names the entry and the icon, and the link is drawn with thelinkicon.Bundled icons:
anaconda,arrow-left,arrow-right,arrow-up,bitbucket,bluesky,book-open,check,chevron-down,chevron-right,circle-plus,circle-x,codeberg,condaforge,copy,discord,discourse,docker,external-link,file-code,github,gitlab,history,info,jupyter,languages,lightbulb,link,list,mastodon,matrix,megaphone,menu,moon,npm,octagon-x,orcid,palette,pencil,pypi,python,readthedocs,search,square-arrow-out-up-right,square-plus,stackoverflow,star,sun,sun-moon,triangle-alert,x,x-twitter,youtube,zenodo,zulip.
icon_links_label¶
Type: text
Default: empty, which names the list “Icon links” in the site’s language
Meaning: The name of the list of icon links, which a screen reader announces before the links.
Source links¶
The edit and view buttons above a page, and the edit-this-page component, link each page to
its source file in the site’s repository. The theme recognises three hosts, github.com,
gitlab.com and bitbucket.org, and reads the host from the address in source_repository.
A repository on any other host gets no edit or view link, and the build does not warn. A page
with no source file of its own, such as the search page or an index, gets none either.
source_repository¶
Type: text
Default: empty
Meaning: The address of the repository that holds the site’s source, such as
https://github.com/SamuelJennings/sphinx-daisyui. A trailing slash or.gitis ignored. With no address, or an address on a host the theme does not recognise, no edit or view link is drawn.
source_branch¶
Type: text
Default:
mainMeaning: The branch the edit and view links lead to.
source_directory¶
Type: text
Default: empty, which means the source files are at the top of the repository
Meaning: The folder of the repository that holds the site’s source files, such as
docs/. A slash at the start or the end is ignored.
On this page¶
The page-toc component lists the headings of the page being read.
show_toc_level¶
Type: integer
Default:
2Meaning: How many levels of headings are listed at all times. Headings deeper than that stay hidden until the section above them is being read. A level of
1lists only the headings directly under the page’s title, a level of2lists the headings under those as well, and a level larger than the page’s deepest heading lists them all.
Component lists¶
article_header_start¶
Type: list of component names
Default:
"breadcrumbs"Meaning: The components at the start of the line above the page’s content. The line is left out when this list and
article_header_endare both empty.
article_header_end¶
Type: list of component names
Default: empty
Meaning: The components at the end of the line above the page’s content.
Pygments styles¶
By default code is drawn with the theme’s token colours. These two options give a mode a
Pygments style instead. Sphinx’s own pygments_style setting is not used: the theme drops
Sphinx’s Pygments stylesheet from every page.
pygments_light_style¶
Type: string
Default: empty, which keeps the theme’s token highlighting
Meaning: The name of the Pygments style code uses in light mode, such as
"friendly". The style follows the mode the page shows, and the system’s colour scheme until the page has a mode. A name that is not a Pygments style is reported as a warning of typedaisyuiand subtypepygments, and the mode keeps the theme’s token highlighting.
pygments_dark_style¶
Type: string
Default: empty, which keeps the theme’s token highlighting
Meaning: The name of the Pygments style code uses in dark mode, such as
"monokai". It follows the mode the page shows in the same way aspygments_light_style, and an unknown name is handled in the same way.
html_theme_options = {
"pygments_light_style": "friendly",
"pygments_dark_style": "monokai",
}