Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Feature Request] Option for different logo in dark/light mode #1063

Closed
istvnurbn opened this issue Oct 3, 2022 · 3 comments
Closed

[Feature Request] Option for different logo in dark/light mode #1063

istvnurbn opened this issue Oct 3, 2022 · 3 comments

Comments

@istvnurbn
Copy link

Hi,

Would it be possible to add a separate dark/light mode logo to the site?

I'm now using a solution by @pushblue.

It is okay for now, but if there will be a major change in the header/footer partial this will cease to work.

My suggestion would be to add two separate icon params under the label group like so:

label:
  text: "my-title"
  iconDark: "my-darkmode-icon.svg"
  iconLight: "my-lightmode-icon.svg"
@icy-comet
Copy link
Contributor

Since you are using SVGs anyway, you could just set fill='currentColor' and pass it to the iconSVG key (introduced with #976) if you want the same icon but just a different color.

@istvnurbn
Copy link
Author

Hi!

I might not fully understand this. If I change the icon key to iconSVG and modify the full codes in the actual SVG file itself Hugo stops displaying the logo altogether.

What is the proper way to do this?

@icy-comet
Copy link
Contributor

icy-comet commented Oct 8, 2022

As discussed in the Twitter DMs, in order to use the iconSVG key, the icon key shouldn't be set as it takes precedence over iconSVG. Then, you can copy-paste the SVG contents as a multiline string in the iconSVG key and set fill='currentColor' of the root <svg> element to make SVG change colors between dark and light mode. You can control the color using custom CSS.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants