Issue #6318๐Ÿ’ฌ AnsweredOpened Nov 20, 2024by tonypapousek3 reactions

Unable to use transparent fill in Block media svg

Quick answerby samexโค 1

I believe it depends on the specific SVG being used. If you check the other SVG icons, you'll notice they don't have a fill attribute (inline) on the main <svg> tag but rather on the child <path> tags. By setting the fill="none" attribute on the two <path> elements of this SVG, the icon should display properly. I hope...

Read full answer below โ†“

Question

GrapesJS version[X] I confirm to use the latest version of [email protected] when this issue was filedWhat browser are you using? Firefox 132, Chrome 131Reproducible demo link https://jsfiddle.net/x54f9v68/1/Describe the bug How to reproduce the bug?Add a custom block, with the media property set to an SVG with a transparent fillCheck the blocks tab, and notice the fill is automatically set to currentColor What is the expected behavior? Fill should be transparent What is the current behavior? Fill inheritscurrentColor, which incorrectly renders the icon Looks like fill is set to current...

Answers (4)

samexโ€ข Nov 21, 2024

I believe it depends on the specific SVG being used. If you check the other SVG icons, you'll notice they don't have a fill attribute (inline) on the main <svg> tag but rather on the child <path> tags. By setting the fill="none" attribute on the two <path> elements of this SVG, the icon should disp...

tonypapousekโ€ข Nov 22, 2024

@samex Specifying fill="none" did the trick, thanks! That'll deffo help get my custom stuff working more predictably. Past that, I think the main pain point would be trying to use third-party SVGs (e.g. "react-icons") or wysiwyg output that doesn't explicitly set the fill attributes. With those use...

artfโ€ข Dec 4, 2024

Yeah I'd close this one as it's not strictly related to the core itself but thanks for point this out

GJS Helperโ€ข May 17, 2026

The issue you're encountering with transparent SVG fills in GrapesJS block media is a known behavior stemming from the editor's default styling. You've correctly identified the root cause: GrapesJS applies a fill: currentColor; style to all SVGs within the .gjs-block elements in the blocks panel. T...

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins โ†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features โ€” save days of integration work.

Browse premium plugins โ†’

Related tutorials

In-depth guides on the same topic.

All tutorials โ†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.