Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change color of caption text in toctree

Is there a way to change the color of captions on a sphinx webpage? I'm using the :caption: directive with toctree, but the caption comes out almost the same color as the sidebar. For reference here is the link to the page with the hard to see captions and here is my index file:

Contents
============

.. toctree::
   :caption: User Documentation
   :maxdepth: 2

   overview
   installation
   tutorial

.. toctree::
   :maxdepth: 2
   :caption: Developer Documentation

   dev/conventions
   dev/enviroment
   dev/docs
   dev/site
   doc/modules

* :ref:`genindex`
* :ref:`modindex`

.. toctree::
   :maxdepth: 2
   :caption: Support

   trouble/faq
   trouble/issuetracker
   trouble/contact
like image 610
Syntactic Fructose Avatar asked Sep 07 '25 19:09

Syntactic Fructose


2 Answers

You could add a color attribut to span.caption-text? For example in your source/_static/custom.cssput:

@import url("default.css");
span.caption-text {
  color: red;
}
like image 118
aflp91 Avatar answered Sep 10 '25 09:09

aflp91


@aflp91 will indeed change caption text in the side bar, but also the caption text in the toctree as well.

If you want the caption color to change in side bar - and side bar only - you should add this

.wy-menu > .caption > span.caption-text {
  color: #ffffff;
}
like image 42
bluesummers Avatar answered Sep 10 '25 08:09

bluesummers