Change single instance of icon

Bring this old post back: Changing a single instance of an icon

I need to change single instances of icons throughout the site. I do not want to use replaceIcon() and override all instances of that icon. I see in the past they made this possible for specific areas of the site, or that is how it reads, but not throughout the site.

For instance, I want to change ONE of the cog icons in search to better reflect what happens when the user clicks it. I do not want to change all cog icons.

Thanks!

1 Like

Have a look at this PR, you might be able to do something similar with just CSS:

2 Likes

This seems hacky, how does it do when you tab through/keyboard only?

1 Like

when one is in the desert and there is apparently no water, hacks can come in very handy!

1 Like

Alas, we are not in the desert… we are paying to use a platform to host a public site.

2 Likes

Which icon is this specifically (where does it appear)? if it seems like there’s a reasonable case others could find useful, we can create an alias for it to allow it to be replaced separately.

2 Likes

Here’s one example where the cog doesn’t reflect the button’s action of opening the expanded search page:

1 Like

We use a “sliders” icon here by default (and it’s the only occurrence of this icon in Discourse by default) — so it would be safe to use replaceIcon() in this case

image

Because we don’t have an API to replace individual icons, the best way we can support this today is by evaluating requests to add new aliases that group similar use cases.

So for example, we use d-liked as an alias for heart so replaceIcon() can be used against d-liked to change it in the like context, rather than replacing every occurrence of the heart icon throughout the app.

It would be nice to replace any single occurrence though, that’s not an unusual situation in themes — hopefully someday we’ll have an API for that.

awesome, it looks like the discourse team changed ours to the sertting cog so I have it fixed up! Thank you :pray:

1 Like