Using own icons possible?

Couldn't see if this was possible, but can we import our own dashboard icons? The included custom icons don't cover the devices I would like to display.

Following. I've seen some others do this probably in the css, but an explanation would be priceless.

1 Like

You can shrink the hubitat icons till they are invisible and then use your own icons as the background image for the tile. Crude but it works.

1 Like

I use base-64 PNGs in my apps/drivers to keep their images local. I’ll test if this works with dashboards tomorrow :slight_smile:

The good news is that it doesn’t seem like the dashboards are parsing out base-64 images, and I think I can nail down some CSS once I get back on my laptop.

1 Like

I think the OP was referring to the action icons Adam

The icons in the center of each tile—correct? I was just testing to see if I could load a completely local element into the dashboard via base-64 :slight_smile: The goal being to use that as the icon. I’ll figure out the styling for that in a bit.

2 Likes

It can be done! First image is the CSS to disable the font icon and inject a background PNG in lieu of it (which I've removed in the image because it can't fit all of the required text). The second image is of the classic Garfield Thanksgiving Special icon I injected with base 64 encoding. This is sloppy CSS. I know there's another way to do this, but I just wanted to do a proof-of-concept, more than anything.

This is 100% local, so you'll never need to worry about icons going missing or anything.

BASE64CSS

2 Likes

Looks great! Can you make the icon dynamic?

Also as I have no clue how/where the CSS code is to be inserted. The documentation appears to be sparse to non existent as to how to implement custom CSS in the dashboard as far as I can tell from searching.

TBH user icons should really be an included feature - the average user is never going to be able to do this.

2 Likes

Sure! Just use the different class selector for each of the active icons.

CSS is under the advanced settings tab. I’d love to see all of this built out in the dashboard, but for now, if none of the built-in icons will work, this will have to do.

Thanks, unfortunately there's nothing in that tab when I looked so no examples as to what to do. Any chance you could provide the sample xml for the icon you posted to see how it hangs together?

I was really happy to find this and wanted to post a little more detail how to get across the finish line. Here is some sample code you can use. Just add this to the CSS tab in the advanced section. You just put regular css selectors in there. These are for a bulb template on and off states. You'll have to base64 encode your own images and embed them. You can also target specific tiles, or all of the bulb templates with teh right combination of CSS selectors.

/* Bulb On Template  */
.tile.bulb .tile-primary.on i {
text-shadow: none !important;
color: rgba(0, 0, 0, 0) !important;
background-image: url([base 64 image here]);
}

/* Bulb Off Template */
.tile.bulb .tile-primary.off i {
text-shadow: none !important;
color: rgba(0, 0, 0, 0) !important;
background-image: url([base 64 image here]);
}

Thanks for posting this. The 2 styles are identical though, is the second one meant to be .tile-primary.off?

@rocketwiz yes, that is correct. I've updated the example code too for clarity.

1 Like

You code will set it as a background but how do you set it as the icon?

@adamkempenich how did you get it to replace the tile icon with the base64 image? Also being that the base 64 coding is lengthy does this break cloud dashboard access (character limitation).

Is there any other method to using custom icon in HE that any has found?

What it is doing is making the text of it icon transparent then setting the background image for the icon to the base64 encoded image. You could include an image URL and it would probably work. You just want to host the images somewhere to make sure they always work. Base64 encoding then embeds the images into the code so the links will never break.

I can’t speak to cloud access issues.

I’ve been working on a phone specific layout, you can see my custom on/off light icons here. I haven’t gotten to the tiles on the left yet.

I got it to work using

#tile-0 .tile-primary i.material-icons:before {content:url ('data:image/svg+xml;base64, BASE64 DATA HERE )
}

but I think the base64 data is going to be too large for cloud access. Would like to point it out to a hosted url, but I cannot figure that one out.... yet.

EDIT: OK got it. This is setup using file manager, change url as needed for cloud access.

#tile-0 .tile-primary i.material-icons:before{
  content: "";
  background-image:url("http://10.13.9.12/local/gandbsmbin-01.svg");
  background-size: 100% 100%;
  display: inline-block;

  /*size of your image*/
  height: 52px;
  width:52px;

  /*if you want to change the position you can use margins or:*/
  position:relative;
  top:5px;
}