1

GitHub supports multiple ways to have a logo displayed depending on dark/light mode. Somehow, any of these options do not seem to work well when the GitHub repository is a Python project uploaded to PyPi.

Here is what I tried, and the effects in PyPi:

![CoGuard Logo Dark](https://github.com/coguardio/coguard-cli/raw/master/logo_dark_mode.png#gh-dark-mode-only)![CoGuard_Light_Logo](https://github.com/coguardio/coguard-cli/raw/master/logo.png#gh-light-mode-only)

Which seems to show the same effect as here on Stack overflow: CoGuard Logo DarkCoGuard_Light_Logo

I.e., both logos are displayed at the same time on the PyPi page.

Option 2:

<p align="center">
  <picture>
    <source srcset="https://github.com/coguardio/coguard-cli/raw/master/logo_dark_mode.png" media="(prefers-color-scheme: dark)">
    <img src="https://github.com/coguardio/coguard-cli/raw/master/logo.png" alt="Light mode logo" width="500">
  </picture>
</p>

This looks in PyPi like the following:

PyPi Display

Okay, here is my overarching question to the community: What is the right way to have dark/light logos AND have them correctly displayed in both GitHub and PyPi?

Albert
  • 163
  • 1
  • 7

1 Answers1

0

I figured out a work-around. I created a second README file, and then added to my setup.cfg of the python project the second, PYPI friendly, README.

Then I added an additional test to my pipeline which ensured that there is no diff between those files after the logo section by ensuring that this diff is empty:

diff <(tail -n +8 README.md) <(tail -n +3 README_PYPI.md)

Albert
  • 163
  • 1
  • 7