Open MEO265 opened 1 month ago
Looks like only supported by ~77% of browsers (https://caniuse.com/link-icon-svg), so wouldn't want to make this the default, but maybe if you have an svg logo we could add it as an extra link?
https://dev.to/masakudamatsu/favicon-nightmare-how-to-maintain-sanity-3al7 suggests that dark mode support for svg requires custom css in the svg, which I suspect few folks will know how to do.
So I don't think it makes sense to do this by default, but it would certainly be nice to give folks the ability to opt-in to an svg favicon. I think the main question on my mind is whether this needs to be an option, or if we could just have a convention for where such a file would be located. For example, maybe if pkgdown/favicon.svg
existed, we could just add it to the <head>
automatically? What do you think?
For example, maybe if
pkgdown/favicon.svg
existed, we could just add it to the<head>
automatically? What do you think?
I think it's a good idea to conditionally include the line depending on whether an SVG favicon (pkgdown/favicon.svg) exists. I will take care of the implementation and submit a PR.
https://dev.to/masakudamatsu/favicon-nightmare-how-to-maintain-sanity-3al7 suggests that dark mode support for svg requires custom css in the svg, which I suspect few folks will know how to do.
Yes, that's true. However, https://realfavicongenerator.net/ offers not only its API but also a simple tool to create SVG favicons optimized for both dark and light mode.
Looks like only supported by ~77% of browsers (https://caniuse.com/link-icon-svg), so wouldn't want to make this the default, but maybe if you have an svg logo we could add it as an extra link?
When Apple (Safari) supports it, I will get back to you regarding the default behavior. Being able to work independently of the resolution is definitely an advantage, even without special features (e.g. dark mode support).
@MEO265 thanks for working on this!
I have two points that could work together. I'm willing to create a PR, but I would like to know in advance what you think is the best option or whether the feature is not wanted at all.
First of all, I would really like to see support for svg favicons. All you would have to do is insert a line in the header above the other icons if the logo is an svg.
<link rel="icon" type="image/svg+xml" href="favicon.svg">
This would allow (monochrome) logos to also have a variant for dark mode users.
Additionally or alternatively, you could use the yamel to allow the code embedded in the header for the favicon to be overwritten.