SVG currentColor 在 GitHub README 中不起作用?

Nic*_*mer 4 css svg github

我正在尝试使 SVG 颜色与 GitHub 自述文件中周围文本的颜色相匹配。(如果将文本设置为"fill=black",则在 GitHub 的深色模式下几乎看不到。)

这里,我认为我可以使用

fill="currentColor"
Run Code Online (Sandbox Code Playgroud)

获取color最近(周围)CSS 元素的属性。我尝试使用显示简单圆圈的 SVG:

fill="currentColor"
Run Code Online (Sandbox Code Playgroud)

SVG 嵌入在 README 中,如下所示

<p align="center">
  <img src="https://nschloe.github.io/smoothfit/disk.svg" width="60%">
</p>
Run Code Online (Sandbox Code Playgroud)

但是,填充颜色始终显示为黑色。

在此输入图像描述

(从这里)。

知道出了什么问题吗?

Nic*_*mer 7

@Alicia 的回复是正确的解释:为了currentColor工作,SVG 需要嵌入到 HTML 中。如果将其作为标签包含在内,则不起作用img。这

<!DOCTYPE html>
<html>
<body>
  Lorem ipsum
  <p style="color:red">
  <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
    <circle r="100" fill="currentColor" />
  </svg>
  </p>

  dolor sit amet
  <p style="color:red">
    <img src="https://nschloe.github.io/smoothfit/disk.svg" width="100px"/>
  </p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

给出

在此输入图像描述