Does Discourse accept SVG icons with Gradient?

I see that any icon with a gradient that I put doesn’t work, does the Discourse not accept it?

If he doesn’t accept it, is there a way to put a gradient around the icons via css?


I have same queries, anybody have any clue regarding this?

If the SVG format supports gradients, then consider it a bug. Probably best reported as a feature request at the git repository.

An svg such a logo should work fine.

AFAIK SVG icon gradients are overridden when their color is set by the CSS?

I saw that there are two ways, by CSS and by the code of the SVG file, but whenever I use one or the other it doesn’t work, the file doesn’t change!

Do you know of a way for me to use gradient on the icons?

CSS gradients won’t work with SVG icons, I believe the gradient has to be applied to the SVG file directly

You can use this trick to make a gradient on SVG icons:

You create an invisible SVG where you define all your gradients associated with an id (e.g.: <linearGradient id="my_id"...)

Then, in your CSS, you target SVG icons and use fill: url(#my-id)

I’m not sure how much it’s ugly, but it works. :smile:

1 Like