GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add backgrounds and borders to admonitions by hugovk · Pull Request #190 · python/python-docs-theme

Conversation

@hugovk

@hugovk hugovk commented Jun 9, 2024

Copy link
Copy Markdown
Member

Only some of the "admonitions" have backgrounds and borders, giving them slightly different indentations:

image

We're missing backgrounds and borders for most of them:

  • https://sphinx-themes.org/sample-sites/python-docs-theme/kitchen-sink/admonitions/

Other themes have them for all:

  • https://sphinx-themes.org/sample-sites/pydata-sphinx-theme/kitchen-sink/admonitions/
  • https://sphinx-themes.org/sample-sites/furo/kitchen-sink/admonitions/
  • https://sphinx-themes.org/sample-sites/sphinx-rtd-theme/kitchen-sink/admonitions/
  • https://sphinx-themes.org/sample-sites/default-alabaster/kitchen-sink/admonitions/

Let's also fill in the gaps.

Before

image image

After

image image

Screenshots using this from the Kitchen Sink:

Details
..
   Copyright (c) 2021 Pradyun Gedam
   Licensed under Creative Commons Attribution-ShareAlike 4.0 International License
   SPDX-License-Identifier: CC-BY-SA-4.0

===========
Admonitions
===========

Sphinx provides several different types of admonitions.

``topic``
=========

.. topic:: This is a topic.

   This is what admonitions are a special case of, according to the docutils
   documentation.

   We also support *italic*, **bold**, ``code``, `links <https://www.sphinx-doc.org/>`_, and more.

``admonition``
==============

.. admonition:: The one with the custom titles

   It's got a certain charm to it.

   We also support *italic*, **bold**, ``code``, `links <https://www.sphinx-doc.org/>`_, and more.

``attention``
=============

.. attention::

   Climate change is real.

   We also support *italic*, **bold**, ``code``, `links <https://www.sphinx-doc.org/>`_, and more.

``caution``
===========

.. caution::

   Cliff ahead: Don't drive off it.

   We also support *italic*, **bold**, ``code``, `links <https://www.sphinx-doc.org/>`_, and more.

``danger``
==========

.. danger::

   Mad scientist at work!

   We also support *italic*, **bold**, ``code``, `links <https://www.sphinx-doc.org/>`_, and more.

``error``
=========

.. error::

   Does not compute.

   We also support *italic*, **bold**, ``code``, `links <https://www.sphinx-doc.org/>`_, and more.

``hint``
========

.. hint::

   Insulators insulate, until they are subject to ______ voltage.

   We also support *italic*, **bold**, ``code``, `links <https://www.sphinx-doc.org/>`_, and more.

``important``
=============

.. important::

   Tech is not neutral, nor is it apolitical.

   We also support *italic*, **bold**, ``code``, `links <https://www.sphinx-doc.org/>`_, and more.

``note``
========

.. note::

   This is a note.

   We also support *italic*, **bold**, ``code``, `links <https://www.sphinx-doc.org/>`_, and more.

``seealso``
===========

.. seealso::

   Other relevant information.

   We also support *italic*, **bold**, ``code``, `links <https://www.sphinx-doc.org/>`_, and more.

``tip``
=======

.. tip::

   25% if the service is good.

   We also support *italic*, **bold**, ``code``, `links <https://www.sphinx-doc.org/>`_, and more.

``warning``
===========

.. warning::

   Reader discretion is strongly advised.

   We also support *italic*, **bold**, ``code``, `links <https://www.sphinx-doc.org/>`_, and more.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

humitos reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@hugovk
Add backgrounds and borders to admonitions
20af5ec
nedbat
nedbat reviewed Jun 9, 2024
View reviewed changes
Comment thread python_docs_theme/static/pydoctheme.css Resolved

Uh oh!

There was an error while loading. Please reload this page.

nedbat
nedbat reviewed Jun 9, 2024
View reviewed changes
Comment thread python_docs_theme/static/pydoctheme.css Resolved

Uh oh!

There was an error while loading. Please reload this page.

hugovk added 2 commits June 10, 2024 14:37
@hugovk
#dfd instead of #bfc for tip background
5e08e29
@hugovk
Re-order to keep colours together
8877845
nedbat
nedbat approved these changes Jun 10, 2024
View reviewed changes
ezio-melotti
ezio-melotti reviewed Jun 10, 2024
View reviewed changes

@ezio-melotti ezio-melotti left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few nitpicky comments, and I also have some additional bikeshedding, since the color choice of some admonition seems somewhat arbitrary to me:

  • attention seems to belong to the category of "potentially dangerous things that you should pay attention too", alongside important, caution, danger, warning, and error. I would probably place it between important and caution, color them gray/yellow, and then proceed with orange/red for more dangerous things -- using blue for attention feels wrong to me.
  • Similarly hint, note, see also, tip are all more neutral admonitions, and for those those I would use a neutral color like gray, blue, or possibly yellow -- green stands out a bit too much IMHO.

We should also check how they look on some real-world example, and see if the colors (and maybe the boxes too) are too distracting. This might actually be the reason why they weren't added in the first place (maybe we should check with the original author too and ask them why they made that choice).

We might also want to leave the bikeshedding for a separate PR (especially if you just copied the colors from another theme) as not to stall this PR.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread python_docs_theme/static/pydoctheme.css Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread python_docs_theme/static/pydoctheme.css Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread python_docs_theme/static/pydoctheme_dark.css Resolved

Uh oh!

There was an error while loading. Please reload this page.

hugovk added 2 commits June 13, 2024 18:36
@hugovk
Specify both color and background-color in case inherited colour chan…
93453ad
…ges and conflicts with background-color
@hugovk
Replace rgba with hex, prefer short hex
338ed55
@hugovk

hugovk commented Jun 24, 2024

Copy link
Copy Markdown
Member Author

Thanks all for the reviews, let's merge and release. We can adjust and iterate the others in the future.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hugovk
hugovk merged commit af191cc into python:main Jun 24, 2024
@hugovk
hugovk deleted the admonition-colour branch June 24, 2024 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ezio-melotti ezio-melotti ezio-melotti left review comments
@nedbat nedbat nedbat approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@hugovk @nedbat @ezio-melotti
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.