-
Notifications
You must be signed in to change notification settings - Fork 357
Description
Hi everyone,
I am trying to color the version switcher button of my docs using a .css file, as explained in the documentation (https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/version-dropdown.html) with the code
.version-switcher__button[data-active-version-name*="dev"] {
background-color: var(--pst-color-secondary);
}
In my conf.py file, I use:
html_theme_options = {
"switcher": {
"json_url": "https://cashocs.readthedocs.io/en/latest/_static/version_switcher.json",
"version_match": switcher_version,
},
}
where the switcher_version evaluates to "dev" at build-time (I have already checked this with a print statement).
For the sake of completeness, my version_switcher.json file is given by
[
{
"name": "dev",
"version": "dev",
"url": "https://cashocs.readthedocs.io/en/latest/"
},
{
"name": "1.8 (stable)",
"version": "1.8.12",
"url": "https://cashocs.readthedocs.io/en/v1.8.12/"
},
{
"version": "1.7",
"url": "https://cashocs.readthedocs.io/en/v1.7.8/"
},
{
"version": "1.6",
"url": "https://cashocs.readthedocs.io/en/v1.6.1/"
},
{
"version": "1.5",
"url": "https://cashocs.readthedocs.io/en/v1.5.15/"
},
{
"version": "1.4",
"url": "https://cashocs.readthedocs.io/en/v1.4.8/"
},
{
"version": "1.3",
"url": "https://cashocs.readthedocs.io/en/v1.3.4/"
},
{
"version": "1.2",
"url": "https://cashocs.readthedocs.io/en/v1.2.1/"
},
{
"version": "1.1",
"url": "https://cashocs.readthedocs.io/en/v1.1.1/"
},
{
"version": "1.0",
"url": "https://cashocs.readthedocs.io/en/v1.0.4/"
}
]
When I don't use the selector, i.e., if I use
.version-switcher__button {
background-color: var(--pst-color-secondary);
}
or even
.version-switcher__button:not([data-active-version-name*="dev"]) {
background-color: var(--pst-color-secondary);
}
then setting the background color works.
Additionally, I was unable to change the text color of the version switcher button with, e.g.,
.version-switcher__button {
color: white;
}
It seems to me that the name "data-active-version-name" might be wrong. What would be the correct way to set this property?
And why am I unable to change the text color?
Trying the same with the "data-version-name" to color the entries inside the version-switcher__container worked as expected.
I am using Sphinx 5.3.0 with the pydata-sphinx-theme 0.12.0 installed using conda.
Thanks a lot for your help.