Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Changing Logo gives black image

Solved by JOduMonT View solution

Started by Jack S 8 years ago · 9 replies · 2591 views
8 years ago

Trying to change my site's logo, I went to user/themes/quark/images and replaced grav-logo.svg with my own logo.

The logo I want to use has a white background and this is what it looks like on my navbar.

Capture2|690x90

So... how do I fix this?

8 years ago

If you replace it with a PNG image (and tweak that filename to match), does it work? If so, it's probably something about the SVG you produced.

8 years ago

Hi Hugh. Already tried that and I get something like this:
cap3|690x316

8 years ago

Oh wow, I've never used Quark but I looked up the template and there's this line:

TWIG
<a href="{{ home_url }}" class="navbar-brand mr-10">{% include('@images/grav-logo.svg') %}</a>

which is a syntax I've never seen, but pretty sure is simply embedding the SVG file markup into the HTML. What that means is that you'll need to modify the template to use a standard <img> tag, so it would be something like:

TWIG
<img src="{{ url(page.media['logo.jpg']) }}" alt="LOGO ALT FIXME" />

This is becoming a non-trivial test! I am pretty sure we'll find your replacement SVG file will be the problem, but you may be happy with the above as a workaround.

8 years ago

Hi @hughbris
Did that! No longer an error, but the logo does not appear.
This is what those few lines of code look like now:

TWIG
                    <section class="navbar-section logo">
                        <a href="{{ home_url }}" class="navbar-brand mr-10"><img src="{{ url(page.media['logo.jpg']) }}" alt="LOGO ALT FIXME" /></a>
                    </section>
8 years ago

I used inspect element and the image tag says source(unknown)
I tried putting it in manually as /user/themes/quark/images/logo.jpg and that DOES work but it's the sloppy way of doing it.

8 years ago

Agree that hardocding is a sucky way to do it. Sorry my suggestion was from memory. Looks like you need to do something more like what you see on https://learn.getgrav.org/content/media#url for the same effect.

If you learn a little about the debugging tools available in Grav, you should be able to get the right expression if that doesn't work. I'd rather point you to that so you can understand and help yourself better in future.

BTW what happens when you try to load your SVG file directly in your browser? I know a little about SVG from a while ago, but not about browser support. It hardly had any when I messed with it!

8 years ago Solution

I did something similar @hughbris

which is removing the include part

TWIG
<a href="{{ home_url }}" class="navbar-brand mr-10">{% include('@images/grav-logo.svg') %}</a>

by a simple img scr=

TWIG
<a href="{{ home_url }}" title="{{ site.title|e('html') }}" class="navbar-brand mr-10"><img src="{{ url('theme://images/logo.svg') }}" width="64px" /></a>

than obviously I made the directory images under the theme and add it logo.svg
which will also works for any kind of image (jpg, png, gif...)

8 years ago

I had the same problem. The solution is much more easier: if you look at the _header.scss file inside the theme folder "scss/theme", then you'll find:

.logo svg path {
fill: $header-color-dark;
}

This line is filling your logo with the dark color. So simply comment this line and recompile your scss files as explained https://learn.getgrav.org/themes/theme-basics#scss-less-css.

👍 2
6 years ago

@jodumont:
<a href="{{ home_url }}" title="{{ site.title|e('html') }}" class="navbar-brand mr-10"><img src="{{ url('theme://images/logo.svg') }}" width="64px" /></a>

Finally this solved my problem! Thank you. (It doesn't work with png but I can live with that)

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 64 18 hours ago
Support · by Anna, 3 days ago
2 68 20 hours ago
Support · by Justin Young, 21 hours ago
1 35 21 hours ago
Support · by Duc , 1 week ago
2 71 6 days ago
Support · by Colin Hume, 1 week ago
2 63 6 days ago