Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to remove dark/light mode button #750

Open
Josh-Hiz opened this issue Jul 25, 2023 · 6 comments
Open

Add an option to remove dark/light mode button #750

Josh-Hiz opened this issue Jul 25, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@Josh-Hiz
Copy link

Context

I designed my Sphinx site to revolve around the Light Theme and do not want users to have access to Dark mode as it simply does not work for the custom directives I have made.

Proposal

Can there be an html theme option, similar to something like use_download_button, perhaps "use_theme_button" with the default being light?

Tasks and updates

No response

@Josh-Hiz Josh-Hiz added the enhancement New feature or request label Jul 25, 2023
@welcome
Copy link

welcome bot commented Jul 25, 2023

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@avivajpeyi
Copy link

Hey @Josh-Hiz -- how did you remove the Dark theme option?

Was it just the following?
pydata/pydata-sphinx-theme#458 (comment)

# conf.py

html_theme_options = {
    "navbar_end": ["navbar-icon-links"],
}

@Josh-Hiz
Copy link
Author

I had tried that but it didn't actually work for some reason, even though the book theme is based on Pydata not everything from Pydata can be applied to the book theme.

@sgpearse
Copy link

sgpearse commented Sep 1, 2023

This is an important issue for my group as well, as darkmode makes our website nearly incomprehensible. We will need to explore other themes if dark mode cannot be removed :(

@canyon289
Copy link

I also would like to be able to remove or disable dark mode entirely

@choldgraf
Copy link
Member

choldgraf commented Dec 18, 2023

This issue would be a long-term fix for this:

In the meantime, you could make this button disappear with the following custom CSS:

button.theme-switch-button {
    display: none !important;
}

This is because the theme switch button has the following HTML and the rule above would select the top-most element and remove it:

<button class="theme-switch-button btn btn-sm btn-outline-primary navbar-btn rounded-circle" aria-label="light/dark" data-bs-placement="bottom" data-bs-toggle="tooltip" data-bs-original-title="light/dark">
    <span class="theme-switch" data-mode="light"><i class="fa-solid fa-sun"></i></span>
    <span class="theme-switch" data-mode="dark"><i class="fa-solid fa-moon"></i></span>
    <span class="theme-switch" data-mode="auto"><i class="fa-solid fa-circle-half-stroke"></i></span>
  </button>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants