WTH I can't specify a background color per section?

We should be able to easily identify sections because they have different background colors. Now it feels like i’m scrolling and looking for my card, could be much easier with some nice colors, right?

Also being able to specify a border easily from within the section would be great, as part of the same enhancement.

2 Likes

I fully support Border + Background for sections…

It would be the end of custom stack-in-cards for me…

I had long submitted it into the github: Feature request: option to display border and background around sections · home-assistant/frontend · Discussion #22288 · GitHub

1 Like

1000% in for this. I do it already using card-mod but it’s way more effort than it should be and makes editing very janky.

@awilson13 that would be usefull to share your code…

Thanks in advance !

Change every beginning of a section from this:

- type: grid
  cards:

To this:

  - type: custom:mod-card
	style: |
	  ha-card {
		margin-top: 20px;
		background-color: #e5eafa !important;
		padding: 5px;
		padding-bottom: 10px;
	  }
	card:
	  type: vertical-stack
	  cards:

This assumes you have card-mod installed and working. That’s all it takes!

1 Like

Why these css properties are used to change a background? )

I’m guessing so it extends past the edge of the cards…maybe?

No, not that simple…
image

A quick test suggests I was correct:


Right, adding a margin merely extends a background of a stack/grid.
But changing a background color should not cause a re-positioning of a content.
Not to mention that mod-card for sections may be used only in SOME cases.

Pretty much anything can be done with a good dose of card-mod, which is great, but this has drawbacks. When used like this it disables the GUI editing.

I think the OP is after a simple way in the GUI to change the bg of blocks which I fully support!

Fully support this anaysis.

Card-mod is a nice workaround, but when feasible, core is better.

And for this specific need a core function could be feasible. It would just request an “appearance” tab into the section menu dealin with section width, section background and section border…

I would love it.

This is right I just liked how it looked better when done like this. I’m not sure if I did it correctly or if there are other drawbacks, I am 100% aware it is janky and am not holding my code up as great or anything.

The disabling UI editing is a real pain in the ass. This would be 100x better as a native feature.