# 使用 currentColor 的自定义图标

**URL:** <https://meta.discourse.org/t/use-custom-icons-with-curentcolor/198704>\
**Category:** Product Support\
**Created:** [2021 年7 月 30 日 15:22 UTC](https://meta.discourse.org/t/use-custom-icons-with-curentcolor/198704 "2021-07-30T15:22:43Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![manuel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/manuel/32/468169_2.png) [@manuel](https://meta.discourse.org/u/manuel)\
发布日期： [2021 年7 月 30 日 15:22 UTC](https://meta.discourse.org/t/use-custom-icons-with-curentcolor/198704/1 "2021-07-30T15:22:44Z")

</div>

我想在一个默认没有图标的主题中显示一些自定义图标。通常这没问题，但我无法使用 `currentColor` 来设置填充色。

所以这样是有效的：  
`&::before {content: svg-uri('<svg fill="red" ...`

![Screenshot from 2021-07-30 16-20-34](https://global.discourse-cdn.com/meta/original/3X/3/7/3771ae4b629176245a8d2d0a25af61c9efa2bba8.png)

但这样不行，它只会默认为黑色：  
`&::before {content: svg-uri('<svg fill="currentColor" ...`

![Screenshot from 2021-07-30 16-21-09](https://global.discourse-cdn.com/meta/original/3X/f/d/fd832238b34b0e3d4436c97a5f657c7983952b0b.png)

有人以前做过类似的事情吗？我不确定我漏掉了什么……

---

_[View the full topic](https://meta.discourse.org/t/use-custom-icons-with-curentcolor/198704)._
