Improve visual readability of the PyTorch documentation

Documentation of PyTorch uses the Freight Sans font for text and IBM Plex Mono for code snippets.

While these are well-designed fonts, the PyTorch docs have terrible visual readability, particularly for users who:

  • Have astigmatism (a type of nearsightedness) and eye fatigue.
  • Are using a high-resolution display without scaling.
  • Are using a low-resolution display.

There are several possible causes:

  • Freight Sans with a lighter font weight at the size of 1rem (16px) is too slim. The small letter spacing makes it very hard to read, especially when the user is using a low-resolution display (<= 1080p) or is not scaling a high-resolution display (4K) appropriately. Users with astigmatism may suffer severe eye fatigue because slim fonts at that size have blurred edges in their vision.
  • Text colors are too light and pale, while the background is too bright. The text is set to #262626 (main text) and #6c6c6d (inline mono, secondary TOC), while the background is set to pure white, which is the brightest color. Such a design distracts users and fails to emphasize the content.
  • Freight Sans is designed to be compact, and even the code font IBM Plex Mono has been shrunk to smaller than 1rem, Freight Sans is still relatively small, causing readability issues.

There are several possible solutions:

  • Use the fallback font as the frontend engineers have assigned, as PyTorch Discuss has done. Helvetica and Arial are ordinary fonts, but they provide exceptional readability. Freight Sans is great, but it should be used in PyTorch brand design, not in documentation.
  • Make the background or the text darker. It is common to use lighter colors for secondary content, but in the case of PyTorch, they are usually too light to be read clearly.
  • Redesign the documentation UI. I understand that it is almost impossible to stop using Sphinx, but more recent tools such as Docusaurus by Meta perform better in terms of readability. It is possible to improve the current UI, layout, and other designs of the PyTorch docs.
2 Likes

Thanks for sharing your feedback.
CC @jspisak