python / python-docs-theme

Sphinx theme for Python documentation
Other
76 stars 59 forks source link

Dark mode: add class to invert image brightness #128

Closed hugovk closed 1 year ago

hugovk commented 1 year ago

For https://github.com/python/cpython/issues/103960.

Re: https://github.com/python/python-docs-theme/pull/44#issuecomment-1526951114.

Add a class to invert image brightness (but not contrast), similar to how we handled it for the PEPs repo: https://github.com/python/peps/pull/2409 and https://github.com/python/peps/pull/2949.

We can then add this class to images like this:

.. figure:: hashlib-blake2-tree.png
   :alt: Explanation of tree mode parameters.
   :class: invert-in-dark-mode

Which changes this:

Details image

Into:

Details image

And light mode remains unchanged:

Details image

This can be merged before or after https://github.com/python/cpython/pull/103983.