如何为 GitHub 的 README.md 文件添加颜色 [英] How to add color to GitHub's README.md file

查看:155
本文介绍了如何为 GitHub 的 README.md 文件添加颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目有一个 README.md 文件

但屏幕截图不是文本,防止读者复制/粘贴屏幕截图中的命令.它们的创建/编辑/维护也很麻烦,并且浏览器加载速度较慢.现代网络使用文本样式,而不是一堆渲染的文本图像.

虽然一些 Markdown 解析器支持内联 HTML 样式,但 GitHub 不支持;这不起作用:

一些绿色文本 </span>

这不起作用:

一些绿色文本 </font>

解决方案

向 README 添加颜色的一种方法是利用提供 占位符图像.

例如可以使用这个 Markdown:

- ![#f03c15](https://via.placeholder.com/15/f03c15/000000?text=+) `#f03c15`- ![#c5f015](https://via.placeholder.com/15/c5f015/000000?text=+) `#c5f015`- ![#1589F0](https://via.placeholder.com/15/1589F0/000000?text=+) `#1589F0`

要创建您喜欢的任何颜色的列表:

  • #f03c15
  • #c5f015
  • #1589F0

I have a README.md file for my project underscore-cli, and I want to document the --color flag.

Currently, the only way to do this is with a screenshot (which can be stored in the project repository):

But screenshots aren't text, preventing readers from copy/pasting the command in the screenshot. They're also a pain to create / edit / maintain, and are slower for browsers to load. The modern web uses text styles, not a bunch of rendered images of text.

While some Markdown parsers support inline HTML styling, GitHub doesn't; this doesn't work:

<span style="color: green"> Some green text </span>

This doesn't work:

<font color="green"> Some green text </font>

解决方案

One way to add color to a README is by utilising a service that provides placeholder images.

For example this Markdown can be used:

- ![#f03c15](https://via.placeholder.com/15/f03c15/000000?text=+) `#f03c15`
- ![#c5f015](https://via.placeholder.com/15/c5f015/000000?text=+) `#c5f015`
- ![#1589F0](https://via.placeholder.com/15/1589F0/000000?text=+) `#1589F0`

To create a list of any colors you like:

  • #f03c15
  • #c5f015
  • #1589F0

这篇关于如何为 GitHub 的 README.md 文件添加颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆