【问题标题】:Change color of caption text in toctree更改目录树中标题文本的颜色
【发布时间】:2015-07-09 19:43:42
【问题描述】:

有没有办法改变 sphinx 网页上的字幕颜色?我将:caption: 指令与toctree 一起使用,但标题与侧边栏的颜色几乎相同。供参考here 是指向带有难以看到标题的页面的链接,这是我的索引文件:

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

【问题讨论】:

  • 您好,您做到了吗?我需要完全相同的东西,下面提供的答案都不适合我......(顺便说一下,我正在使用 sphinx_rtd_theme)

标签: html css python-sphinx caption toctree


【解决方案1】:

你可以给 span.caption-text 添加颜色属性吗?例如在你的source/_static/custom.cssput:

@import url("default.css");
span.caption-text {
  color: red;
}

【讨论】:

  • 这不仅改变了侧边栏的颜色,还改变了toctree指令标题... 只改变侧边栏颜色的解决方案是什么?
【解决方案2】:

@aflp91 确实会更改侧边栏中的标题文本,还会更改 toctree 中的标题文本。

如果您希望在侧边栏中更改标题颜色 - 并且仅在侧边栏中 - 您应该添加此

.wy-menu > .caption > span.caption-text {
  color: #ffffff;
}

【讨论】:

    猜你喜欢
    • 2012-02-24
    • 2017-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多