python / python-docs-theme

Sphinx theme for Python documentation
Other
74 stars 58 forks source link

Use different colour for 'Return value: Borrowed reference' #188

Closed hugovk closed 3 months ago

hugovk commented 4 months ago

Follow on from https://github.com/python/cpython/pull/117926.

Currently light green is used for all return types:

For example: https://docs.python.org/3/c-api/exceptions.html

image

image

image

A borrowed reference is not necessarily a "bad" thing, but we may want to use something other than green that indicates it's "good", to indicate they should be treated with care.

This PR uses the same yellow/orange colour as the "Changed in version x.y" text in https://github.com/python/python-docs-theme/pull/185 - I've already checked the contrast ratios in that PR and both meet WCAG AAA. By using the same colour, it will be easier to check/change when we audit.

image image

For example: https://python-docs-theme-previews--188.org.readthedocs.build/en/188/c-api/exceptions.html#querying-the-error-indicator

vstinner commented 4 months ago

This PR uses the same yellow/orange colour as the "Changed in version x.y" text in https://github.com/python/python-docs-theme/pull/185

FYI As a color blind person, I don't see the difference between "Borrowed reference" and "New reference" colors in the light mode. Well, I'm also color blind, so my opinion may not matter :-)

In the dark mode, I see clearly that the two colors are very different.

flying-sheep commented 4 months ago

If you’re reusing existing colors, how about you centralize their definition as a CSS variables and then use it from both your new CSS rules and the old ones that originally defined the color?

hugovk commented 4 months ago

Good idea, shall we also replace the pale green for the other "Return value" with the "New in version" green?

image

The light mode ones are much closer, but we could replace one with the other here too?

image

hugovk commented 3 months ago

Updated:

image

image

image

image

Suggestions for better variable names welcome :)

hugovk commented 1 month ago

This is now deployed: https://docs.python.org/3/c-api/exceptions.html