[WIKI] Custom CSS snippets, verified on SharpTools

Thanks for sharing. Might be a helpful snippet for someone who only wants the title on certain tiles to be truncated or not. There’s a dashboard setting (hidden behind the advanced option) to enable or disable truncation of titles across all tiles in the dashboard:

Since you mentioned Hero Attribute Tiles, there’s a setting for the hero attribute tile to wrap or truncate the content on those too. :grinning:

This setting had no effect on the hero attribute title. It was truncated in both the Wrap and Truncate setting.

1 Like

Just pushed a hotfix to resolve the Hero Attribute title not respecting the dashboard’s truncate setting. Thanks for the heads up. :slight_smile:

1 Like

Ha! I was thinking it was a bug that was missed and just not reported. Honestly took me some time to figure out why a couple of titles truncated and others did not, but only about 15 minutes snooping around the DOM to figure it out, so didn’t think to report it. Thanks for the quick fix!

1 Like

Does anybody know if there is CSS code to add Glow or change the color of Glow on a tile?

I use this for some icons I’ve assigned a specific style to.

#app .tile.--theme-style-dash-active:not(.spacer) .icon  {
   -webkit-filter: drop-shadow(0 0 2px #ffc30B) drop-shadow(0 0 2px #ffc30B);
   filter: drop-shadow(0 0 2px #ffc30B) drop-shadow(0 0 2px #ffc30B);
}

I’m just on phone, not computer so can’t tell if it’s formatted properly.

2 Likes

I got it to work, thank you very much.

1 Like

If you want a shadow behind text (e.g. to improve contrast) here’s the CSS code I’ve used lately, that I don’t see listed. This is for main content (e.g. hero text on a thermostat tile), but works for title and footer too:
.tile .main-content { text-shadow: 2px 2px 8px #000000a0; }

The first two numbers set the shadow offset, the third sets the shadow blur size and the fourth is the shadow color (transparency works, so this is black with a transparency of A0 (160 in decimal, out of 255, where 0 is fully transparent, 255 or ff is totally opaque).

This works with theme style specific CSS too, which is probably where it is best used.

1 Like

Can you use CSS on an individual tile? I have 1 or 2 tiles on a dashboard that I want to change the text size on but I don’t want it applied to everything.

Also, how do you adjust the font size of the default Month calendar?

Yes you can, you have the set those tiles to use a custom style, and then you can use the technique in this thread to apply CSS only to that style: How to move text / labels in tiles with CSS

1 Like

My apologies, this code is inconsistent (it works in Chrome on Windows, but does not work in Chrome on Android or Fully Kiosk Browser on Fire OS). After a bit more playing around, this does work for hero text:
.tile .main-content { font-size: 2.35em!important; }
However, be sure to test it on the platform you’re using, as I’ve found the results to be variable (I get a slightly larger font on Android and Fire OS than I do on Windows, I’ve no idea why, and its not much different, but do be sure to check).

1 Like

Is there a way to add text in tile footer?

1 Like

You could use the :before pseudoselector along with the content property.

.tile.switch .tile-footer .status > span:before {
   content: "Switch is "
}

.tile.lock .tile-footer .status > span:before {
    content: "Lock is ";
}

.tile.door-control .tile-footer .status > span:before {
    content: "Door is ";
}

Please note that any custom CSS snippets provided are not officially supported and may need to be adjusted with potential future changes to the SharpTools web app.

2 Likes

Might be stupid question, but how do I find out tile.type?
Examples seems to be stwitch, lock and door-control. How do I know the right type for certain tiles in my dashboard?

I shared some tips on how to do this

2 Likes

Thank’s @Chris_C . That works!
Is there a way to add custom css to specific tile? I have few switches in my dashboard and if I add css it will affect to every switch tile and I would only need customize one tile.

The last example from the wiki shows how you can use a custom style named ‘warning’ and the css to target it.

So its .--theme-style- and then your style name in lowercase.

Alright I have to try that one out.

I still have one question as you are now willing to answer all my stupid questions :smiley:

image

Is there a way to change color when mode changes to night or away and same thing for HSM when mode changes to Armed?

I used to have three tiles …each for location mode (Day, Away, Night). Now that I’m using mode changer tile (just on tile) it is always as grey as it is. I would like to get more attention with colors when for example HSM is armed (so that my kids do not open door accidentally when HSM is armed)

Hi All,

I’ have the dashboard in an iframe with some dynamic images behind it. I would therefor like to make the dashboard background transparent.
I almost got it working but on the tag i have this class: “grey darken-3 white-text”. Is there a way to overwrite or remove the grey and darken-3 class ? If so then it would be transparent.

/Rasmus

Make sure to use !important to override it. Something along these lines…

body.grey.darken-3 { background-color: transparent!important; }
1 Like