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 colour to version change directives by hugovk · Pull Request #185 · python/python-docs-theme

Conversation

@hugovk

@hugovk hugovk commented Mar 29, 2024 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Similar to the sidebars in PEP 7 and PEP 8, we can add coloured sidebars and text to the version change directives.

Dark theme

image

Light theme

image

Accessibility check

  • We're not relying on the colour in the sidebar or text to convey meaning. The words remains as before.
  • The text like "Changed in version x.y" is now in colour. The contrast ratio meets at least the WCAG AA guidelines (4.5), with all but one meeting AAA (7.0).
  • In dark mode, the same colour is used for the sidebar and the text:
    • Green: 7.13 (AAA)
    • Yellow: 12.07 (AAA)
    • Red: 4.53 (AA)
  • In light mode, the sidebar colour is the same as in dark mode. The text needs to be darker to be readable:
    • Green: 7.08 (AAA)
    • Orange: 7.11 (AAA)
    • Red: 7.09 (AAA)

versionremoved

I also pre-emptively applied the red styling for the versionremoved directive, which will be released in the next Sphinx 7.3.0 (sphinx-doc/sphinx#11905).

Comparison with other themes

This is similar to how the Awesome theme does it.

These themes also add a background colour:

  • Sphinx Book Theme
  • PyData Sphinx Theme
  • Sphinx theme for Wagtail

And Nefertiti for Sphinx adds a coloured box around it.

Sorry, something went wrong.

Uh oh!

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

erlend-aasland reacted with rocket emoji
All reactions
  • 🚀 1 reaction
@hugovk
Add coloured sidebars to versionadded/changed/deprecated
30bd94f
@hugovk hugovk added the enhancement label Mar 29, 2024
@hugovk hugovk changed the title Add coloured sidebars to versionadded/changed/deprecated Add colour to version change directives Mar 29, 2024
erlend-aasland
erlend-aasland approved these changes Mar 29, 2024
View reviewed changes
willingc
willingc approved these changes Mar 29, 2024
View reviewed changes

@willingc willingc left a comment

Copy link
Copy Markdown
Contributor

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.

Thanks @hugovk. I would love to see us move away from red and green. Since the wording is here too, I'm less concerned. When we work with an accessibility designer, we should come up with best practice light/dark themes for accessiblity.

Sorry, something went wrong.

Uh oh!

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

erlend-aasland, hugovk, and pradyunsg reacted with thumbs up emoji
All reactions
  • 👍 3 reactions
@hugovk
hugovk merged commit 5d781d2 into python:main Mar 29, 2024
@hugovk
hugovk deleted the versionchanged-sidebars branch March 29, 2024 21:29
@hugovk hugovk mentioned this pull request Apr 10, 2024
Fix version directive indents python/cpython#117719
Merged
@hugovk hugovk mentioned this pull request Apr 17, 2024
Use different colour for 'Return value: Borrowed reference' #188
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@willingc willingc willingc approved these changes
@erlend-aasland erlend-aasland erlend-aasland approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

enhancement

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 @willingc @erlend-aasland
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.