# Change icons globally

**URL:** https://meta.discourse.org/t/change-icons-globally/87751
**Category:** Developer Guides
**Tags:** how-to
**Created:** [May 17, 2018, 3:45pm UTC](https://meta.discourse.org/t/change-icons-globally/87751 "2018-05-17T15:45:00Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [May 17, 2018, 3:45pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/1 "2018-05-17T15:45:00Z")

</div>

This is an easy way to change a Discourse icon globally.

1. Right click on the icon you want to change and select “Inspect element” or “Inspect” (depends on the browser)

2. Find the icon name  

3. Search a new icon here [Find Icons with the Perfect Look & Feel | Font Awesome](https://fontawesome.com/icons?d=gallery), e.g. [external-link-alt](https://fontawesome.com/icons/external-link-alt?style=solid)

4. Customize and add the code in your `admin > customize > themes > edit code -> JS` tab

```gjs
// {theme}/javascripts/discourse/api-initializers/init-theme.gjs

import { apiInitializer } from "discourse/lib/api";

export default apiInitializer((api) => {
  api.replaceIcon("link", "external-link-tab");
});

```

1. Icons that are not used by default from Discourse must be added in the site setting `svg icon subset` then force refresh your browser to see the changes applied.  
**Result:**  
 ![image](https://global.discourse-cdn.com/meta/original/4X/c/8/5/c8531f6df84a8c81cff3433c27b5e24c9e2b2580.png)  
All the “link” icons will be replaced by “external-link-tab”.  
If an icon is used for multiple elements in other pages, such as badges, the icon will also be replaced there.

* * *

## Exceptions

_Note that there is already a theme component that allow you to [change the Like icon](https://meta.discourse.org/t/change-the-like-icon/87748/1). I’m using this case as example_

The “heart” icon, used to give Like, is hardcoded with other names (`'d-liked'` and `'d-unliked'`) and should be treated differently than other icons, so to change the ❤ icon with 👍 icon:

```js
api.replaceIcon("d-liked", "thumbs-up");
api.replaceIcon("d-unliked", "thumbs-o-up");

```

![like](https://global.discourse-cdn.com/meta/original/4X/5/2/0/520c013bf27287ab540eaac51ee277a538aa5e16.png)  
 ![firefox_2018-04-24_18-37-02](https://global.discourse-cdn.com/meta/original/4X/8/8/7/887bc3d441fbf1d5dbf8f7b881972433a822ffa8.png)  
but on the badge page the icon is still “heart”:

 ![firefox_2018-04-24_18-38-15](https://global.discourse-cdn.com/meta/original/4X/c/0/9/c09be93aad477146c3b4b5e984778954e6c88fa2.png)  
so to change it on that page we add:

```js
api.replaceIcon("heart", "thumbs-up");

```

 ![firefox_2018-04-24_18-47-50](https://global.discourse-cdn.com/meta/original/4X/e/d/e/edeb02505da2b318ebcbdffaf1a3bf58a9f6be3f.png)

Another example:

```js
api.replaceIcon("d-watching", "eye");

```

changes the watching icon:

 ![watching-original](https://global.discourse-cdn.com/meta/original/4X/8/1/9/819e3400d2e2de90ed6bb3769f4e43b792b4e67e.png) ![watching](https://global.discourse-cdn.com/meta/original/4X/1/3/f/13f43088d33cc827659a0a5c6f14c4ff4e31d1a7.png)

> **See here other exceptions that cover the tracking status, expand/collapse, notifications and likes of course.**
>
> ```js
> const REPLACEMENTS = {
> "d-tracking": "bell",
> "d-muted": "discourse-bell-slash",
> "d-regular": "far-bell",
> "d-watching": "discourse-bell-exclamation",
> "d-watching-first": "discourse-bell-one",
> "d-drop-expanded": "caret-down",
> "d-drop-collapsed": "caret-right",
> "d-unliked": "far-heart",
> "d-liked": "heart",
> "d-post-share": "link",
> "d-topic-share": "link",
> "notification.mentioned": "at",
> "notification.group_mentioned": "users",
> "notification.quoted": "quote-right",
> "notification.replied": "reply",
> "notification.posted": "reply",
> "notification.edited": "pencil-alt",
> "notification.bookmark_reminder": "discourse-bookmark-clock",
> "notification.liked": "heart",
> "notification.liked_2": "heart",
> "notification.liked_many": "heart",
> "notification.liked_consolidated": "heart",
> "notification.private_message": "far-envelope",
> "notification.invited_to_private_message": "far-envelope",
> "notification.invited_to_topic": "hand-point-right",
> "notification.invitee_accepted": "user",
> "notification.moved_post": "sign-out-alt",
> "notification.linked": "link",
> "notification.granted_badge": "certificate",
> "notification.topic_reminder": "far-clock",
> "notification.watching_first_post": "discourse-bell-one",
> "notification.group_message_summary": "users",
> "notification.post_approved": "check",
> "notification.membership_request_accepted": "user-plus",
> "notification.membership_request_consolidated": "users",
> "notification.reaction": "bell",
> "notification.votes_released": "plus",
> "notification.chat_quoted": "quote-right",
> };
> 
> ```
> 
> Ref: [discourse/icon-library.js at main · discourse/discourse (github.com)](https://github.com/discourse/discourse/blob/main/frontend/discourse/app/lib/icon-library.js)

* * *

Feel free to create other themes component and share it in our #Customization > Theme component category!

* * *

This document is version controlled - suggest changes [on github](https://github.com/discourse/discourse/blob/main/docs/developer-guides/docs/05-themes-components/28-global-icon-changes.md).

---

<div class="post-metadata">

### Author: ![thegurjyot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thegurjyot/32/120516_2.png) [@thegurjyot](https://meta.discourse.org/u/thegurjyot)
#### Post date: [March 6, 2019, 10:17pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/3 "2019-03-06T22:17:37Z")

</div>

Your post does help in changing icons globally but how to change the share icon in posts only? I do not want to change the link icon in the editor but, only in the posts. I checked the other posts in the forum but none of those work in the current build of Discourse, thus I am asking it here.

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [April 22, 2019, 6:04pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/4 "2019-04-22T18:04:51Z")

</div>

thanks for the clear guide. a small point:

is it possible to change `d-watching` to `fas fa-eye` and `d-tracking` to `far fa-eye` together?

if yes, how would one add the `fas` icon to the svg; as I tried adding `fa-eye` and this header:

`<script type="text/discourse-plugin" version="0.8">`  
` api.replaceIcon('d-watching', 'fa-eye');`  
` api.replaceIcon('d-tracking', 'eye');`  
` </script>`

but the watching icon is not working.

* * *

also I was checking other icons such as `bells`, and I see even when I add bells to the `svg icon subset` it’s not loaded:

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/b/7b053ee4f98fb2c8fc7e25ef3735bf4effdbf574.png)

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/6/e66ad8c7d5c9d7f1ea274f578799cbc3e6ae0df1.png)

 ![image](https://global.discourse-cdn.com/meta/original/3X/d/d/ddc25280893e19e0a189bee21d18b804673763dc.png)

is there anything else I should do in order to be able to use `bells`?

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [April 23, 2019, 2:08pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/5 "2019-04-23T14:08:22Z")

</div>

> [@Pad\_Pors](#):
>
> even when I add bells to the `svg icon subset` it’s not loaded

[Bells](https://fontawesome.com/icons/bells?style=solid) is a Pro icon, so it can’t be included, our default FA5 implementation only covers the free icons.

The solid eye icon is a bit of a special case: the FontAwesome 4 eye icon was moved to the regular bundle, so in Discourse we have a matcher for it that converts ‘eye’ to ‘far-eye’. Unfortunately, this stops you from using the solid ‘eye’ icon in Discourse, because Discourse will redirect `eye` to `far-eye`. If you absolutely must use that icon, you can copy the svg into a custom icon that you can rename to something of your liking, and add that to a theme or plugin.

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [April 23, 2019, 5:25pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/6 "2019-04-23T17:25:38Z")

</div>

thanks for the complete information 👍 , meanwhile I’ve tried several other icons, e.g. [user-shield](https://fontawesome.com/icons/user-shield?style=solid).

here is the header:  
`<script type="text/discourse-plugin" version="0.8">`  
` api.replaceIcon('d-watching', 'fa-user-shield');`  
` </script>`

and I added `fa-user-shield` to the `svg icon subset`, but it still shows empty icon.

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [April 23, 2019, 5:37pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/7 "2019-04-23T17:37:49Z")

</div>

Try without the “fa-” prefix for user-shield (both in the JS code and the site setting).

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [April 23, 2019, 5:42pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/8 "2019-04-23T17:42:55Z")

</div>

> [@pmusaraj](#):
>
> user-shield

still empty (tried with flag for easier snapshot):

 ![image](https://global.discourse-cdn.com/meta/original/3X/8/0/803ecb08a4eb1982945a672e1d68d62349b5cfb0.png)

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [April 23, 2019, 5:45pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/9 "2019-04-23T17:45:41Z")

</div>

That works locally for me. Did you refresh the page after making these changes?

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [April 23, 2019, 5:50pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/10 "2019-04-23T17:50:52Z")

</div>

yes, refreshed with F5 and ctrl+R just to be sure!

is there anyway to look for possible errors?

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [April 23, 2019, 5:52pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/11 "2019-04-23T17:52:46Z")

</div>

If you are familiar with the rails console, I would try logging in to the console and running `SvgSprite.expire_cache` and then refreshing the page to see if that does it.

---

<div class="post-metadata">

### Author: ![GuilhermeBac](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/guilhermebac/32/139122_2.png) [@GuilhermeBac](https://meta.discourse.org/u/GuilhermeBac)
#### Post date: [April 23, 2019, 10:56pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/12 "2019-04-23T22:56:32Z")

</div>

How to change the solid (fas fa-bookmark) to regular version (far fa-bookmark)?

> **[Bookmark Filled Icon (Classic Solid) — Free SVG Download | Font Awesome](https://fontawesome.com/icons/bookmark?style=regular)**
>
> Download the Bookmark filled icon as a free SVG or PNG. A bold Classic Solid style icon for web and app projects.

---

<div class="post-metadata">

### Author: ![P16](https://avatars.discourse-cdn.com/v4/letter/p/b19c9b/32.png) [@P16](https://meta.discourse.org/u/P16)
#### Post date: [April 25, 2019, 11:26am UTC](https://meta.discourse.org/t/change-icons-globally/87751/13 "2019-04-25T11:26:11Z")

</div>

@dax Is there a way to change the default heart icon to an emoji icon?

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [April 25, 2019, 1:36pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/14 "2019-04-25T13:36:43Z")

</div>

Currently, no, you can only replace svg icons with other svg icons, not emojis.

---

<div class="post-metadata">

### Author: ![porterbayne](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@porterbayne](https://meta.discourse.org/u/porterbayne)
#### Post date: [September 15, 2019, 1:52pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/15 "2019-09-15T13:52:12Z")

</div>

Is it possible to change to custom SVG icons we add, rather than just FA icons?

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [September 15, 2019, 2:15pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/16 "2019-09-15T14:15:11Z")

</div>

Yes, see [Introducing Font Awesome 5 and SVG icons](https://meta.discourse.org/t/introducing-font-awesome-5-and-svg-icons/101643) for details.

---

<div class="post-metadata">

### Author: ![porterbayne](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@porterbayne](https://meta.discourse.org/u/porterbayne)
#### Post date: [September 15, 2019, 2:44pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/17 "2019-09-15T14:44:12Z")

</div>

Thank you! I also found [Replace Discourse’s default SVG icons with custom icons in a theme](https://meta.discourse.org/t/replace-discourses-default-svg-icons-with-custom-icons-in-a-theme/115736)

I ended up embedding the SVG sprite directly into the Header file, as uploading it and naming it as that article says to do did not work for me (could be operator error, of course).

So my Header is:

```
<svg width="0" height="0" class="hidden" style="display: none;">
    <symbol id="myicon-search" ..... </symbol>  
    <!-- all of my symbols here... -->
</svg>
<script type="text/discourse-plugin" version="0.8">
    api.replaceIcon('search', 'myicon-search'); 
</script>

```

And that is easy to manage.

I use the SVG sprite generator at [https://svgsprit.es](https://svgsprit.es/) to make sure the format is correct.

---

<div class="post-metadata">

### Author: ![bekircem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bekircem/32/44582_2.png) [@bekircem](https://meta.discourse.org/u/bekircem)
#### Post date: [February 1, 2020, 10:46pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/18 "2020-02-01T22:46:24Z")

</div>

Can we use Microsoft’s [Fabric Icons](https://developer.microsoft.com/en-us/fabric#/styles/web/icons) with this method?

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [February 2, 2020, 1:05pm UTC](https://meta.discourse.org/t/change-icons-globally/87751/19 "2020-02-02T13:05:54Z")

</div>

You should be able to, yes. I don’t see an official SVG sprite distribution of those icons, but according to [Where can I find the svg files of the icons? · Issue #1008 · OfficeDev/office-ui-fabric-core · GitHub](https://github.com/OfficeDev/office-ui-fabric-core/issues/1008) you can extract SVGs yourself, one by one, using their names.

---

<div class="post-metadata">

### Author: ![tomwrench](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tomwrench/32/54576_2.png) [@tomwrench](https://meta.discourse.org/u/tomwrench)
#### Post date: [May 2, 2020, 2:54am UTC](https://meta.discourse.org/t/change-icons-globally/87751/20 "2020-05-02T02:54:28Z")

</div>

> [@thegurjyot](#):
>
> Your post does help in changing icons globally but how to change the share icon in posts only? I do not want to change the link icon in the editor but, only in the posts. I checked the other posts in the forum but none of those work in the current build of Discourse, thus I am asking it here.

I’m trying to do the same thing. I’ve changed the ‘share’ icon successfully in posts but it appears it also changes the ‘link’ icon in the editor. Any ideas how to change _just_ the posts icon?

---

<div class="post-metadata">

### Author: ![ghgoodreau](https://avatars.discourse-cdn.com/v4/letter/g/7ba0ec/32.png) [@ghgoodreau](https://meta.discourse.org/u/ghgoodreau)
#### Post date: [July 30, 2020, 2:25am UTC](https://meta.discourse.org/t/change-icons-globally/87751/21 "2020-07-30T02:25:14Z")

</div>

Is there a way to change a fontawesome icon globally to an SVG icon uploaded in the theme upload section? I am working on a site and would like to specifically change the fontawesome icon for when a topic is solved (using the discourse-solved plugin) to my site’s logo. I am having a hard time approaching this via the actual plugin code and I was wondering if this header method works for something like that.

[Next page](https://meta.discourse.org/t/change-icons-globally/87751.md?page=2)
