Skip to content

thomasloven/hass-fontawesome

Repository files navigation

hass-fontawesome

hacs_badge

Use free icons from the fontawesome version 6.6.0 set in Home-assistant.

Installation instructions

  • Install using HACS (Or copy the contents of custom_components/fontawesome/ to <your config dir>/custom_components/fontawesome/.)

    Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

  • Restart Home Assistant

  • Click this: Open your Home Assistant instance and start setting up a new integration.

    • Alternatively: Go to your integrations configuration, click Add Integration and find "Fontawesome icons"

Icon sets

The icons are divided into three sets.

  • Solid
  • Regular
  • Brands

Usage

Find the icon you want in the gallery.

The three icon sets have different prefixes: fas:, far: and fab: respectively.

So,

  • to get a solid heart, use fas:heart
  • to get a heart outline, use far:heart
  • to get the github logo, use fab:github

image

The icons are useable anywhere in Home Assistant - not only in lovelace.

Using with custom icons

If you have other svg icons you want to use (including but not limited to the Fontawesome Pro set), you can do so by placing the .svg files in <Home Assistant Config>/custom_icons/. You will need to create this directory yourself.

You can then use those icons with the fapro: prefix. E.g. fapro:lamp will get the icon in the file <Home Assistant Config>/custom_icons/lamp.svg.

Duotone icons

If you have duotone icons, they should contain path elements with the ids fa-primary and fa-secondary or primary and secondary.

You can adjust how the icons look a bit by using the suffixes #invert, #color or #color-invert image

More advanced icons

You can also use more advanced icons, e.g. with multiple colors if you add the suffix #fullcolor. ISmIwO2TJN

You can find some nice ones over at flaticons.com.

Note: SVG files can also contain embedded CSS inside <style> tags...
This gives you some interesting... posibilities...

Hass-fontawesome will not allow any icons containing embedded javascript, though.


IMPORTANT: As the note above implies, SVG can contain CSS and Javascript, and thus shall be considered unsafe. Home Assistant normally protects you from this by only using a very specific part of the SVG file, but using the #fullcolor suffix circumvents this protection. I have tried adding another layer instead, but as those things go, you're only safe from the things you know.

In short: Only do this with icons you trust (and preferably have inspected the code for).


FAQ

Can I set this up in configure.yaml instead?

Yes.

fontawesome:

That's it.


Buy Me A Coffee