In the sample “new like icon” repo, we see:
<script type="text/discourse-plugin" version="0.8">
api.replaceIcon('d-liked', 'thumbs-up');
api.replaceIcon('d-unliked', 'thumbs-o-up');
api.replaceIcon('notification.liked', 'thumbs-o-up');
api.replaceIcon('notification.liked_2', 'thumbs-o-up');
api.replaceIcon('notification.liked_many', 'thumbs-o-up');
api.replaceIcon('heart', 'thumbs-up');
</script>
I don’t know that I’d have guessed to replace notification.liked_many_2
Where could we see a list of all the icons in use by discourse?
2 个赞
tshenry
(Taylor)
2019 年3 月 22 日 00:28
2
11 个赞
I was trying to replace an icon over in this topic: How to replace an icon using CSS
The icon in question was .d-icon-lock, but I don’t see it in the list above. Where would I find the icon, so I know what to target in the api.replaceIcon above?
tshenry
(Taylor)
2019 年3 月 24 日 01:44
4
In this case you would just use the FA icon name:
<script type="text/discourse-plugin" version="0.8">
api.replaceIcon('lock', 'times-circle');
</script>
5 个赞
I see. I guess I was asking for a list of all icons… perhaps searching the source for {d-icon ' is what I’m looking for.
oshyan
(Oshyan Greene)
2021 年10 月 31 日 02:35
6
我有同样的问题,而且上面的链接无法使用。我搜索并浏览了这个主题的许多内容:Introducing Font Awesome 5 and SVG icons
但同样,我没有看到任何列表来了解某个图标是否属于核心集。在论坛上也无法找到其他相关的搜索结果。
1 个赞
ondrej
2021 年10 月 31 日 09:48
7
oshyan:
我没有看到列表来确认某个图标是否属于核心集。
Discourse 使用免费的 Font Awesome 图标。所有可用的图标均可在此处找到:https://fontawesome.com/v5.15/icons?d=gallery&p=2&s=regular,solid&m=free 。您可能需要在站点设置中将某些图标添加到“SVG 图标子集”中。您可以通过在 URL 后添加 /styleguide/atoms/icons 来查看站点上有哪些图标。如果未显示,请检查站点设置中是否已启用“styleguide”。
如果您想访问专业版图标,需要安装插件:https://meta.discourse.org/t/fontawesome-pro-icons/150871。
5 个赞
pfaffman
(Jay Pfaffman)
2021 年10 月 31 日 14:25
8
5 个赞
oshyan
(Oshyan Greene)
2021 年10 月 31 日 17:17
9
感谢 @ondrej 和 @pfaffman !我熟悉 Font Awesome 的使用,也知道自己可能需要添加一些 新的图标,这就是为什么我想了解其中包含了哪些内容。Meta 和 Styleguide 插件的链接都非常有帮助。我仍然在某些 情况下(但奇怪的是并非所有情况)对如何添加新图标感到有些困惑,不过我会就此单独创建一个主题/回复。
2 个赞