Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add custom icons #92

Open
vaga opened this issue Oct 6, 2022 · 6 comments
Open

Add custom icons #92

vaga opened this issue Oct 6, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@vaga
Copy link
Owner

vaga commented Oct 6, 2022

I have to find a solution to add custom icons.

@vaga vaga added the enhancement New feature or request label Oct 6, 2022
This was referenced Oct 6, 2022
@dogo77
Copy link

dogo77 commented Nov 1, 2022

hi,
i noticed that feather icons hasn't accepted new icons since over 2 years, and a lot of icons are missing in this set (ie. mastodon to name one)
might switching to https://simpleicons.org/ be an option?
greets

@scabux
Copy link

scabux commented Nov 5, 2022

Lucide seems to be quite nice, too. It is a community-driven fork of Feather Icons. See https://lucide.dev/ for available icons. Perhaps this could replace Feather Icons, considering that the latter seems to be rather inactive?

@QuAzI
Copy link

QuAzI commented Nov 10, 2022

  • telegram icon would be nice

@andrewbaker-uk
Copy link

I've just been toying at replacing the feather icons with the icons from Font-Awesome. Not sure where to start though

@xeraa
Copy link
Contributor

xeraa commented Jan 29, 2023

This is a total hack, but I added a custom partial of icon.html in my layouts/partials/ so that I could add a Mastodon icon:

{{- if isset .ctx.Site.Data.m10c.icons .name -}}
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-svg{{ .name }}">
  <title>{{ .name }}</title>
  {{ safeHTML (index .ctx.Site.Data.m10c.icons .name) }}
</svg>
{{- else if fileExists (printf "/assets/img/simpleicons/%s.svg" .name) -}}
<svg viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="0" stroke-linecap="round" stroke-linejoin="round" class="icon icon-svg{{ .name }}">
  <title>{{ .name }}</title>
  {{ readFile (printf "/assets/img/simpleicons/%s.svg" .name) | safeHTML }}
</svg>
{{- else -}}
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-svglink">
  <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path>
  <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path>
</svg>
{{- end -}}

Then I put the path info (so only <path d="..."/>) to a file with the name I want to add into /assets/img/simpleicons/.

The style of https://simpleicons.org doesn't fit a 100% but I felt like this was ok enough:
Screenshot 2023-01-29 at 06 20 31

@xeraa
Copy link
Contributor

xeraa commented Jan 30, 2023

On second thought, I've slightly reworked it to work with the unchanged files from https://simpleicons.org.

My custom icon.html:

{{- if isset .ctx.Site.Data.m10c.icons .name -}}
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-svg{{ .name }}">
  <title>{{ .name }}</title>
  {{ safeHTML (index .ctx.Site.Data.m10c.icons .name) }}
</svg>
{{- else if fileExists (printf "/assets/img/simpleicons/%s.svg" .name) -}}
<span class="icon">
  {{ readFile (printf "/assets/img/simpleicons/%s.svg" .name) | safeHTML }}
</span>
{{- else -}}
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-svglink">
  <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path>
  <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path>
</svg>
{{- end -}}

And a small customization to the SCSS file:

span.icon {
  fill: currentcolor;
  stroke: currentcolor;
  stroke-width: 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants