The page¶
What the theme leaves on every page for a site’s own CSS and scripts to read.
Widths¶
Three custom properties set the width of the page’s columns. They are set on the .daisy-layout element, so a site
changes one by setting it again on that element in a stylesheet listed in html_css_files.
Property |
Default |
Sets |
|---|---|---|
|
|
The width of the primary sidebar |
|
|
The width of the page |
|
|
The width of the secondary sidebar |
For example, _static/custom.css can set the primary sidebar to 16rem:
.daisy-layout {
--daisy-primary-width: 16rem;
}
conf.py then lists the stylesheet:
html_css_files = ["custom.css"]
Attributes on the body¶
The <body> element carries five attributes that the theme’s scripts read and a site’s scripts
may read too.
Attribute |
Holds |
|---|---|
|
The path from the page to the site’s root, such as |
|
The file suffix of the pages, such as |
|
The suffix that links to pages use, such as |
|
The name of the builder that wrote the page, such as |
|
The page’s name, such as |
Attributes on the root element¶
The <html> element carries six attributes that describe the colour the page is drawn in. The
theme sets them before the page is first drawn, so a site’s stylesheet can rely on them and no
page flashes the wrong colours. A site’s own stylesheets and scripts may read them. They are not
a place to write: the theme’s script owns them.
Attribute |
Holds |
|---|---|
|
The daisyUI theme the page is drawn with, such as |
|
|
|
The reader’s choice: |
|
The theme the light mode draws, from |
|
The theme the dark mode draws, from |
|
The starting mode: |
data-mode follows the theme in use. A theme picked by name counts as dark when its colour scheme
is dark. Style something differently in dark mode by keying on it:
html[data-mode="dark"] .diagram {
filter: invert(1);
}
Translated text¶
The theme’s own text is translatable. Setting language in conf.py selects the translation, and
Sphinx reads the theme’s messages from the sphinx domain with the rest of its own. The catalogue
template ships in the package at sphinx_daisyui/locale/sphinx.pot.