【问题标题】:Changing README.md image display conditional to GitHub light-mode / dark-mode将 README.md 图像显示更改为 GitHub light-mode / dark-mode
【发布时间】:2021-04-01 10:52:19
【问题描述】:

是否可以将 GitHub 中的 README.md 图像显示更改为 GitHub 暗模式和亮模式?也许我可以在我的 README.md 中放入一个简单的条件。

【问题讨论】:

  • 目前还没有解决方案,但是以后登陆这里的任何人都可能想检查这个线程github.community/t/…

标签: github readme


【解决方案1】:

现在可以根据主题有条件地指定要显示的图像,方法是在所需的浅色\深色主题图像链接末尾使用以下关键字。

#gh-dark-mode-only #gh-light-mode-only

^examples的使用:

<p align="center">
    <img src="https://raw.githubusercontent.com/GiorgosXou/Random-stuff/main/StackOverflow/Answers/70200610_11465149/b.png#gh-light-mode-only" height="120" width="120"/>
    <img src="https://raw.githubusercontent.com/GiorgosXou/Random-stuff/main/StackOverflow/Answers/70200610_11465149/w.png#gh-dark-mode-only" height="120" width="120"/>
</p>
![GitHub-Mark-Light](https://raw.githubusercontent.com/GiorgosXou/Random-stuff/main/StackOverflow/Answers/70200610_11465149/b.png#gh-light-mode-only)
![GitHub-Mark-Dark ](https://raw.githubusercontent.com/GiorgosXou/Random-stuff/main/StackOverflow/Answers/70200610_11465149/w.png#gh-dark-mode-only)

确保图像存储在 github 中,否则它们将不会根据主题动态显示。更多信息请点击herehere

【讨论】:

    猜你喜欢
    • 2023-01-18
    • 2021-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-09
    • 2022-12-27
    • 2014-08-10
    相关资源
    最近更新 更多