MrDogeBro / sphinx_rtd_dark_mode

Adds a toggleable dark mode to the Read the Docs theme for Sphinx.
sphinx-rtd-dark-mode.vercel.app
MIT License
54 stars 17 forks source link

Function and class names are black when compiled on readthedocs #28

Open dwiddo opened 2 years ago

dwiddo commented 2 years ago

When locally compiled, the names of functions and classes are blue as intended. But when compiled on readthedocs, the colors turn black and are difficult to read.

Screenshot 2022-02-01 100812

vlandau commented 2 years ago

I'm having the same issue, but it persists locally and when deploying to gh-pages after the build (via github actions) (via make clean html)

Cielquan commented 2 years ago

I have the same issue. It also applies to click CLI apps documented with sphinx-click.

image

For me the local build is already black.

dwiddo commented 2 years ago

It may help to mention that I solved this issue by specifying sphinx-rtd-theme==0.5.2, it seems that 1.0.0 is causing the issue.

photoniker commented 2 years ago

Is there some activity regarding this issue? I still have dark class names.

sanjacob commented 11 months ago

I have this issue when using the theme along Breathe

sanjacob commented 11 months ago

Here's what I have come up with as a quick fix:

html[data-theme="dark"].writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .sig-name {
    color: var(--dark-text-color);
}

html[data-theme="dark"].writer-html5 .rst-content dd dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .sig-name {
    color:inherit;
}

YMMV

FreyJo commented 3 months ago

The issue is also visible in the docs of this project: https://sphinx-rtd-dark-mode.vercel.app/api.html#filter-object

rod7760 commented 2 months ago

I played around with fixing this yesterday, but I'm a bit stumped. No clue how to make a reasonable CSS selector for the class text.

rod7760 commented 2 months ago

I ended up coming up with this based off of the proejct FreyJo sent.

/* "class" text */
html.writer-html5
  .rst-content
  section
  > dl:first-of-type
  > dt:first-of-type
  > .property {
  color: green;
}

/* first part of signature 
i.e. `content_filter.` in the Python example
*/
html.writer-html5
  .rst-content
  dl[class]:not(.option-list):not(.field-list):not(.footnote):not(
    .citation
  ):not(.glossary):not(.simple)
  > dt
  > .sig-prename {
  color: orange;
}

/* second part of signature 
i.e. `Filter.` in the Python example
*/
html.writer-html5
  .rst-content
  section
  dl[class]:not(.option-list):not(.field-list):not(.footnote):not(
    .citation
  ):not(.glossary):not(.simple)
  > dt:first-child
  > .sig-prename
  + .descname {
  /*only select descnames that have a prename in front. Avoids selecting function signature
  descnames */
  color: orange;
}

I wanted to be as specific as possible, but I fear this might be too specific. I built off of the already complex selectors, but if this looks like more madness please let me know.

You can view it on stackblitz here. I will follow up after testing it on a non-python project.