sphinx-material icon indicating copy to clipboard operation
sphinx-material copied to clipboard

Optional dark theme

Open johnthagen opened this issue 4 years ago • 25 comments

It would be really neat if there was a configuration option to enable a dark mode (light text on a dark background). This would enable producing docs that looks like: https://fastapi.tiangolo.com/

Screen Shot 2020-12-07 at 9 15 21 AM

johnthagen avatar Dec 07 '20 14:12 johnthagen

Whenever I get around to updating to the latest Material for MkDocs this should be possible.

bashtage avatar Dec 23 '20 13:12 bashtage

Happy to accept PRs that do the sync 👍

bashtage avatar Dec 23 '20 13:12 bashtage

For reference, the dark theme scheme seems to be called slate and can be enabled in Material for MkDocs as shown here: https://squidfunk.github.io/mkdocs-material-insiders/setup/changing-the-colors/#color-palette-toggle

theme:
  palette:
    scheme: slate
...

The toggle at the top of the page will toggle slate on and off for their example application.

johnthagen avatar Jan 12 '21 15:01 johnthagen

+1 I would be absolutely keen for this

If there is a CSS override I would also be keen to explore - I have opened #95 which proposes to explore this.

@johnthagen is this more of a general comment or is this something that can be enabled in the sphinx-material theme? The reason why I am asking is because if there is a way to enable it currently in a project using sphinx-material that would be really useful

axsaucedo avatar Feb 21 '21 06:02 axsaucedo

@axsaucedo This is more of a general feature request that I think would be a really great addition to this project. I don't know how to enable this currently.

johnthagen avatar Feb 21 '21 11:02 johnthagen

Once I sync with material mkdocs (hopefully in the next couple of months) this should become available.

bashtage avatar Feb 24 '21 13:02 bashtage

This isn't in this project because slate wasn't a color in material mkdocs when I initially wrote the project.

bashtage avatar Feb 24 '21 13:02 bashtage

I attempted to look into updating to sync in changes from material mkdocs. However, it isn't at all clear how to do that. Can you describe the process by which you derived this package from the mkdocs package?

jbms avatar Feb 26 '21 20:02 jbms

I spent some time rebasing this package on mkdocs-material HEAD. I discarded the existing css and javascript since it isn't really in editable form anyway, and just used the original scss/typescript sources from mkdocs-material with only minimal modifications. I also kept the jinja html templates as close to the mkdocs ones as possible. That way keeping up to date with it in the future should be a lot easier. I have everything working about 90% now, including the dark theme support. I will send out a pull request shortly, once I've cleaned up the build scripts a bit more.

jbms avatar Mar 01 '21 07:03 jbms

@jbms This sounds very exciting! Thanks!

johnthagen avatar Mar 01 '21 11:03 johnthagen

@jbms This is more or less the way the original version came to be, so this makes sense. Looking forward to seeing and trying the PR.

bashtage avatar Mar 01 '21 11:03 bashtage

@johnthagen @bashtage See pull request #96

jbms avatar Mar 03 '21 18:03 jbms

Any update on this.

Cryptex-github avatar Aug 21 '21 05:08 Cryptex-github

doesnt seem like it

ooliver1 avatar Dec 05 '21 14:12 ooliver1

@2bndy and I are now developing a fork of this theme (based on newer mkdocs-material), which includes dark mode, separately in https://github.com/jbms/sphinx-immaterial.

jbms avatar Dec 05 '21 15:12 jbms

Once I sync with material mkdocs (hopefully in the next couple of months) this should become available.

Any news on this feature @bashtage?

baco avatar Oct 02 '22 19:10 baco

Ping! Any updates here?

vsoch avatar Jan 09 '23 18:01 vsoch

There's a fork with the desired option! https://github.com/jbms/sphinx-immaterial

jermanuts avatar Apr 18 '23 13:04 jermanuts

Is there any reason you chose a fork instead of contributing upstream? The first reply in this thread suggested they would be welcome to accept a PR.

ooliver1 avatar Apr 18 '23 13:04 ooliver1

@ooliver1 well, for starters, jermanuts is only mentioning the fork, he's not the author of the fork, there's nothing bad with that. I, for myself, can not code in JS, but would like to include documentation with Sphinx in my Python projects instead. I would go for the fork.

Second, this project seems to be abandoned (no commits on the entire 2022). No answers from the developers whatsoever. Furthermore, if you go through the history of this issue thread, there's a PR (ignored for two years now), from the author of the fork, trying to contribute back in the days to this project.

When you get ignored that many times, forks arise. But there's no one to blame here, perhaps bashtage just got tired of maintaining this project, and that's OK. And obviously, the community got tired of waiting and took action, and that's OK too.

I don't think jermanuts deserves to be questioned, in public, for proposing the fork.

baco avatar Apr 18 '23 14:04 baco

I would be happy to move the project on to someone who wants to work on it. I don't have the time or the inclination to maintain it, and especially to improve it. When I started it I took the material theme post rendering and so integrating changes like color variants was not easy.

bashtage avatar Apr 18 '23 14:04 bashtage

As for the fork, it is OSS. Forking and improving is essential (precisely for cases like this, among other reasons).

bashtage avatar Apr 18 '23 14:04 bashtage

If I can get statsmodels and my own repos to work well with immaterial, then I'll probably move to it in the next release and officially mothball this. If @jbms is interested in the name on PyPI, please get in touch.

bashtage avatar Apr 18 '23 14:04 bashtage

I think at this point changing the sphinx-immaterial package name would just create confusion.

jbms avatar Apr 18 '23 16:04 jbms

I agree, but just wanted to offer it in case.

bashtage avatar Apr 18 '23 16:04 bashtage