ElkArte Community

Elk Development => Theme development => Topic started by: Jorin on June 06, 2018, 02:15:20 am

Title: Menu icons
Post by: Jorin on June 06, 2018, 02:15:20 am
Is there a list what icons can be used for the menu? I want to add one and need another icon for it.
Title: Re: Menu icons
Post by: badmonkey on June 06, 2018, 03:44:46 am
This site has a font awesome list. Codes are included if you click on the icon.  ;)
Title: Re: Menu icons
Post by: ahrasis on June 06, 2018, 06:15:39 pm
I think you should be able to use any font awesome icons (https://fontawesome.com/icons?from=io).
Title: Re: Menu icons
Post by: emanuele on June 07, 2018, 07:15:28 am
Technically you can use whatever icon you want, you can just add it somewhere and refer to it in your css. ;)
I would use that technique over any other, because those "readily available" are those used in the software that are quite limited (you can see the names from icons_svg.css in your theme CSS folder).

In order to give you some more meaningful answer, what icon do you need and where do you want to put it?
Title: Re: Menu icons
Post by: Jorin on June 07, 2018, 07:28:41 am
Thanks to you three!

I want to use fa-bookmark for a new menu button for bookmarks, placed between notifications and new posts button.
Title: Re: Menu icons
Post by: Spuds on June 07, 2018, 09:20:10 am
This will seem like a WTF, ZOMG, why is this so difficult, but its just a few easy steps between you and icon nirvana.  Note this is just how I do it, it may not be, and is likely not, the best, but when I need an icon or two for use its what I do.  There are some tools to pull entire font sets to SVG, search for font ripper on github for inspiration

A quick guide for how to use / add SVG icons to ElkArte 1.1

Selection your Icon(s)

Damit, I want my icon now method
  • Hover over your icon image, and select "get code"
  • Copy the section the says "Symbol Definition"  in this example it should be as follows
<symbol id="icon-bookmark" viewBox="0 0 32 32"><title>bookmark</title><path d="M6 0v32l10-10 10 10v-32z"></path></symbol>
background-image: url("data:image/svg+xml,%3Csymbol id='icon-bookmark' viewBox='0 0 32 32'%3E %3Ctitle%3Ebookmark%3C/title%3E %3Cpath d='M6 0v32l10-10 10 10v-32z'%3E%3C/path%3E %3C/symbol%3E");
Code: [Select]
.i-bookmark::before {
content: url("data:image/svg+xml,%3Csymbol id='icon-bookmark' viewBox='0 0 32 32'%3E %3Ctitle%3Ebookmark%3C/title%3E %3Cpath d='M6 0v32l10-10 10 10v-32z'%3E%3C/path%3E %3C/symbol%3E");
}

Damit, I want my icons to be optimized method
Code: [Select]
<!-- Generated by IcoMoon.io -->
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<title>bookmark</title>
<path d="M6 0v32l10-10 10 10v-32z"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M6 0v32l10-10 10 10V0z"/></svg>
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M6 0v32l10-10 10 10V0z'/%3E%3C/svg%3E");
Code: [Select]
.i-bookmark::before {
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M6 0v32l10-10 10 10V0z'/%3E%3C/svg%3E");
}

You can change colors, fills, weights, etc ... if wanted I can to a short write up on that as well.
Title: Re: Menu icons
Post by: Jorin on June 11, 2018, 06:54:45 am
Quote from: Spuds – You can change colors, fills, weights, etc ... if wanted I can to a short write up on that as well.

Would be great! Then we could split and lock your answers as a new topic if that's okay with you? A "how to..."  :)
Title: Re: Menu icons
Post by: Jorin on June 21, 2018, 05:22:18 am
Thanks, I did it! Hurray!  :D

For 1.1.5 please use some nicer icons. Or at least they should have the same background color and line width.  ;)