英文:
Github Darkmode vs lightmode images and PyPi
问题
GitHub支持多种方式来根据深色/浅色模式显示标志。不知何故,当GitHub存储库是上传到PyPi的Python项目时,这些选项中的任何一个似乎都无法正常工作。
这是我尝试过的方法以及在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)
这似乎在PyPi页面上显示了与此处在Stack Overflow上显示的相同效果:
即,在PyPi页面上同时显示两个标志。
选项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>
在PyPi中,这看起来像下面这样:
好的,这是我向社区提出的总体问题:如何以正确的方式拥有深色/浅色标志并确保它们在GitHub和PyPi中正确显示?
英文:
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:
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:
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?
答案1
得分: 1
我找到了一个解决方法。
我创建了第二个README文件,然后将第二个适用于PYPI的README添加到我的Python项目的setup.cfg中。
然后,我在我的流水线中添加了一个额外的测试,以确保在标志部分之后这两个文件之间没有差异,通过确保此差异为空来实现:
diff <(tail -n +8 README.md) <(tail -n +3 README_PYPI.md)
英文:
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)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论