Light Card
Sections are split:
Main Icon Styling
You can style the main icon like this:
Change the icon type/mdi.
![image](https://community-assets.home-assistant.io/original/4X/b/b/5/bb5fb131375e5478bc7543c814c4e1f6f58c3188.png)
card_mod:
style: |
ha-state-icon {
--card-mod-icon: mdi:mushroom;
}
Change the icon color.
![image](https://community-assets.home-assistant.io/original/4X/3/2/1/32103fd475a51803107f59ca0d946d21c0fc5d0a.png)
card_mod:
style: |
ha-state-icon {
color: orange;
}
Change icon size.
![image](https://community-assets.home-assistant.io/original/4X/b/b/f/bbf78f354ad721ffe2a8f80a9118c208d6d2f2fa.png)
card_mod:
style: |
ha-state-icon {
--icon-symbol-size: 40px;
}
Rotate Icon.
![image](https://community-assets.home-assistant.io/original/4X/c/a/9/ca96f1f21c7b09b0d0a2fb829dbb022892259aa0.png)
card_mod:
style: |
ha-state-icon {
rotate: 30deg;
}
Offset/Pad Icon.
![image](https://community-assets.home-assistant.io/original/4X/7/0/2/702f935ababd908fa7730f36db84a516c4e8df5b.png)
This one there is a couple different ones you can use, and also some different value types. i would just play around with it until you find what you like.
card_mod:
style: |
ha-state-icon {
padding-right: 30px;
padding-left: 10px;
padding-bottom: -20px;
height: 20px;
width: 50px;
}
Animate the Icon.
![Untitled video - Made with Clipchamp (46)](https://community-assets.home-assistant.io/original/4X/c/4/d/c4d79df1b237d5cffaee4207be4f818f609bfe64.gif)
If you are using an animation you need to put your keyframes outside of the ha-state-icon, like the below.
card_mod:
style: |
ha-state-icon {
animation: wobbling 0.7s linear infinite alternate;
}
@keyframes wobbling {
0% {transform: rotate(-80deg);}
100% {transform: rotate(40deg);}
}
End Icon Styling Section
Main Icon Background/Shape Styling
You can style the main icon background/shape like this:
Shape Color.
![image](https://community-assets.home-assistant.io/original/4X/1/3/7/13790d133db74371b591f6b4f5429904401af4eb.png)
card_mod:
style:
mushroom-shape-icon$: |
.shape {
--shape-color: orange !important;
}
Shape Size.
![image](https://community-assets.home-assistant.io/original/4X/6/3/5/6354d82ee191c0931ea6172245cb244850c3d800.png)
You should set the icon size to 21px as this is the standard size for mushroom cards. you are then free to change the size of the shape without affecting the icon.
card_mod:
style:
mushroom-shape-icon$: |
.shape {
--icon-symbol-size: 21px;
--icon-size: 100px;
}
Shape Shadow.
![image](https://community-assets.home-assistant.io/original/4X/d/e/1/de1b777b95b4c808f8c19e897ef3eb104243aaf4.png)
![image](https://community-assets.home-assistant.io/original/4X/7/a/d/7ad941028db016c40ee654ea89c63f96809e2c5f.png)
Left with shadow, right standard without shadow. !important seems to be required.
card_mod:
style:
mushroom-shape-icon$: |
.shape {
box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.36) !important;
}
Shape “Shape”?
![image](https://community-assets.home-assistant.io/original/4X/b/b/e/bbed94e542555d054c7c316134e72fb5fa232902.png)
Note that it doesnt seem like you can use negative values here.
card_mod:
style:
mushroom-shape-icon$: |
.shape {
padding-right: 40px;
padding-left: 10px;
padding-bottom: 10px;
border-radius: 0px !important;
}
Shape Outline/Border.
![image](https://community-assets.home-assistant.io/original/4X/8/1/1/811fe25ba33ab44cbe7541ba7511c73f2b115642.png)
the different border types can be found here.
card_mod:
style:
mushroom-shape-icon$: |
.shape {
border: 2.5px outset green
}
Shape Animation.
![Untitled video - Made with Clipchamp (47)](https://community-assets.home-assistant.io/original/4X/e/8/c/e8c90d0d1ad51f74c1d8f775494ee3827f01d06a.gif)
If you are using an animation you need to put your keyframes outside of the .shape, like the below.
card_mod:
style:
mushroom-shape-icon$: |
.shape {
--shape-animation: ping 2s infinite;
}
@keyframes ping {
0% {box-shadow: 0 0 0 0 rgba(var(--rgb-red), 0.7);}
70% {box-shadow: 0 0 0 10px transparent;}
100% {box-shadow: 0 0 0 0 transparent;}
}
End Shape/Icon Background Styling Section
Card Styling
The card body itself can be styled like this:
Background Color.
![image](https://community-assets.home-assistant.io/original/4X/f/4/4/f44c7f895c1ac04988b1ee290d2e380aacddc2ac.png)
Note that any buttons and also seem to change color according to this color. you can style the buttons and slider seperately which you will see later in the guide.
card_mod:
style: |
ha-card {
background-color: #002f7a;
}
Background outline/border.
![image](https://community-assets.home-assistant.io/original/4X/9/6/9/9697bacbbd4bd6591c61666b1404a0a40b51a13e.png)
Note that setting a border size does seem to change the actual card size slightly. border types can be found here.
card_mod:
style: |
ha-card {
border: 2.5px outset blue
}
Card shadow.
![image](https://community-assets.home-assistant.io/original/4X/2/a/1/2a1bc8303ec1c89c73f11d1ee936cc4cf75ae544.png)
![image](https://community-assets.home-assistant.io/original/4X/4/9/e/49e8ff8374e4cfc5f7eddd0eb231eb7ccf4bb028.png)
You can use this to both add a shadow and remove one if your theme has a shadow by default like mine does (minimalist).
Add Shadow.
card_mod:
style: |
ha-card {
box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.66);
}
Remove Shadow.
card_mod:
style: |
ha-card {
box-shadow: none;
}
Card size.
![image](https://community-assets.home-assistant.io/original/4X/e/5/3/e53356d9bb2baa2eba90d83d76e7c641b742ecdb.png)
This changes the outside size of the card. not any of the interior contents. you have to use !important it seems for height to actually change.
card_mod:
style: |
ha-card {
height: 200px !important;
width: 200px;
}
Card padding.
![image](https://community-assets.home-assistant.io/original/4X/c/c/d/ccd51ade0a2d2ab2454870b1ac14910c87c3934b.png)
This adds interior padding to the card and therefore squishes the internals into the dimensions of the card more. the interior items will get smaller. you have to use !important it seems for padding to take effect.
card_mod:
style: |
ha-card {
padding-right: 150px !important;
padding-left: 150px !important;
padding-bottom: 30px !important;
padding-top: 30px !important;
}
Card margins.
![image](https://community-assets.home-assistant.io/original/4X/0/a/e/0aebf401e87c8f7d12ee638e22d58de79343dfb8.png)
Card margin adds blank space to the outside of the card squeezing the entire card (interiror and exterior) into a smaller space, making the whole card smaller.
card_mod:
style: |
ha-card {
margin-top: 30px;
margin-bottom: 30px;
margin-left: 30px;
margin-right: 30px;
}
Card Border/Corner Radius.
![image](https://community-assets.home-assistant.io/original/4X/c/a/7/ca7adcb76cee85bea3a2a2771482d34158b3ab8b.png)
Changes the radius of the corners. this is set to 0. so sharp corners.
card_mod:
style: |
ha-card {
border-radius: 0px;
}
Card Shape Animation
![Untitled video - Made with Clipchamp (48)](https://community-assets.home-assistant.io/original/4X/0/8/8/088e60f39b1e84f5d5f2aef6dfe2712db9409ef2.gif)
you need to put your keyframes outside of the ha-card like the below.
card_mod:
style: |
ha-card {
border-radius: 20px !important;
animation: ping 2s infinite;
}
@keyframes ping {
0% {box-shadow: 0 0 0 0 rgba(var(--rgb-red), 0.7);}
70% {box-shadow: 0 0 0 10px transparent;}
100% {box-shadow: 0 0 0 0 transparent;}
}
End of Card Styling Section
Text Styling
Primary (or first line) text can be styled like this:
Change Font.
![image](https://community-assets.home-assistant.io/original/4X/4/b/9/4b9d46bac261c3899153c149d095b74656fd0783.png)
maybe dont use Wingdings ![:wink: :wink:](https://community.home-assistant.io/images/emoji/twitter/wink.png?v=12)
card_mod:
style: |
ha-card {
font-family: "Wingdings 2";
}
Change Font Style.
![image](https://community-assets.home-assistant.io/original/4X/3/4/e/34e063b8f2a342b98f75c4dffd6c57eac39656ce.png)
Font styles can be found here.
card_mod:
style: |
ha-card {
font-style: italic;
}
Change Font Variant.
![image](https://community-assets.home-assistant.io/original/4X/d/f/3/df30648e365988b4ac02fdd477f5d253ab25e879.png)
Font variants can be found here.
card_mod:
style: |
ha-card {
font-variant: small-caps;
}
Change Font Size.
![image](https://community-assets.home-assistant.io/original/4X/9/2/3/923f579fe0c6eacf7da519b7727f26e19075fea9.png)
I have not found a way to change font size for text across the board. you have to do them individually it seems.
card_mod:
style:
mushroom-state-info$: |
.container {
--card-secondary-font-size: 20px;
--card-primary-font-size: 20px;
}
Change Font Color.
![image](https://community-assets.home-assistant.io/original/4X/5/9/6/596068b5d18577235031e1063ab494630c8bfcb7.png)
I have not found a way to change color for text accross the board. you have to do them individually it seems.
card_mod:
style:
mushroom-state-info$: |
.container {
--card-primary-color: blue;
--card-secondary-color: orange;
}
Change Alligment
![image](https://community-assets.home-assistant.io/original/4X/f/d/3/fd3fcf2f74c61176a408fa9eb60d2ee031afe407.png)
Different allignment options can be found here.
card_mod:
style:
mushroom-state-info$: |
.container {
align-items: end;
}
Change Rows.
![image](https://community-assets.home-assistant.io/original/4X/8/7/c/87c0222b8a3d6431ad5718d48a321d14ac0aff99.png)
Gap will need to be adjusted depending on your primary text length. you can find the different types of flex direction here. yaml courtesy of @zanixmechanix
card_mod:
style:
mushroom-state-info$: |
.container {
flex-direction: row !important;
align-items: baseline;
gap: 10px;
}
End of Text Styling Section
Selection Value Styling
N/A Light Card has no Selection Value.
End of Selection Value Styling Section
Badge Icon Styling
N/A Light Card has no Badge Icon.
End of Badge Icon Styling Section
Badge Icon Background/Shape Styling
N/A Light Card has no Badge Icon.
End of Badge Icon Shape Styling Section
Slider Styling
If you have sliders they can be controlled like this:
Change color.
![image](https://community-assets.home-assistant.io/original/4X/0/e/3/0e3410359624922f5640eaf8c74d91e405425149.png)
![image](https://community-assets.home-assistant.io/original/4X/b/0/e/b0ebaad4b975a4aa54ef4a1279593da24e775cb6.png)
![image](https://community-assets.home-assistant.io/original/4X/d/c/1/dc1f6c4fedfb53b4a3cddb6c95f7f84757193908.png)
This will override any color already there (like for example if you have use light color turned on).
card_mod:
style:
mushroom-light-brightness-control$: |
mushroom-slider {
--main-color: teal !important;
--bg-color: #d1eced !important;
}
mushroom-light-color-control$: |
mushroom-slider {
--gradient: -webkit-linear-gradient(right, red 0%, orange 10%, yellow 20%, lightgreen 30%, green 40%, lightblue 50%, blue 60%, purple 70%, fuchsia 80%, red 100%) !important;
}
mushroom-light-color-temp-control$: |
mushroom-slider {
--gradient: -webkit-linear-gradient(right, teal 0%, white 100%) !important;
}
Change Size
![image](https://community-assets.home-assistant.io/original/4X/f/0/2/f02a4bb270f91fb55bd910e62e9522f411206da5.png)
There isnt enough space to make the slider any bigger so if that is your aim i would recommend making the box that they live in bigger as well. like the below. of course this doesnt apply if you are making the buttons smaller. !important is required.
card_mod:
style:
mushroom-light-brightness-control$:
mushroom-slider$: |
.slider {
width: 200px !important;
height: 200px !important;
}
mushroom-light-color-control$:
mushroom-slider$: |
.slider {
width: 200px !important;
height: 200px !important;
}
mushroom-light-color-temp-control$:
mushroom-slider$: |
.slider {
width: 200px !important;
height: 200px !important;
}
.: |
mushroom-light-brightness-control {
height: 200px;
}
mushroom-light-color-control {
height: 200px;
}
mushroom-light-color-temp-control {
height: 200px;
}
Rotate slider
![image](https://community-assets.home-assistant.io/original/4X/d/3/8/d384572aaa0f559023b3591cc77a15468bfee45a.png)
I would not recommend using this. the control doesnt follow the direction of the slider. it is just a bad idea.
card_mod:
style:
mushroom-light-brightness-control$:
mushroom-slider$: |
.slider {
rotate: 90deg;
}
mushroom-light-color-control$:
mushroom-slider$: |
.slider {
rotate: 90deg;
}
mushroom-light-color-temp-control$:
mushroom-slider$: |
.slider {
rotate: 90deg;
}
.: |
mushroom-light-brightness-control {
height: 200px;
}
mushroom-light-color-control {
height: 200px;
}
mushroom-light-color-temp-control {
height: 200px;
}
Offset/Pad Slider
![image](https://community-assets.home-assistant.io/original/4X/5/b/c/5bca105118e7bf630eee4f7269ac8e39c024769b.png)
You have to use margin instead of padding. padding only seems to make the slider itself bigger.
card_mod:
style:
mushroom-light-brightness-control$:
mushroom-slider$: |
.slider {
margin-right: 100px;
margin-top: 30px !important;
}
mushroom-light-color-control$:
mushroom-slider$: |
.slider {
margin-right: 100px;
margin-top: 30px !important;
}
mushroom-light-color-temp-control$:
mushroom-slider$: |
.slider {
margin-right: 100px;
margin-top: 30px !important;
}
.: |
mushroom-light-brightness-control {
height: 74px;
}
mushroom-light-color-control {
height: 74px;
}
mushroom-light-color-temp-control {
height: 74px;
}
Animate Slider Shape.
![Untitled video - Made with Clipchamp (49)](https://community-assets.home-assistant.io/original/4X/7/4/4/744cf19403d0936fe9f4a5ebe32039da587f3f96.gif)
i would recommend adding some padding so that the animation has the space to show. you need to put your keyframes outside of the .slider, like the below.
card_mod:
style:
mushroom-light-brightness-control$:
mushroom-slider$: |
.slider {
animation: ping 2s infinite;
}
@keyframes ping {
0% {box-shadow: 0 0 0 0 rgba(var(--rgb-red), 0.7);}
70% {box-shadow: 0 0 0 10px transparent;}
100% {box-shadow: 0 0 0 0 transparent;}
}
mushroom-light-color-control$:
mushroom-slider$: |
.slider {
animation: ping 2s infinite;
}
@keyframes ping {
0% {box-shadow: 0 0 0 0 rgba(var(--rgb-red), 0.7);}
70% {box-shadow: 0 0 0 10px transparent;}
100% {box-shadow: 0 0 0 0 transparent;}
}
mushroom-light-color-temp-control$:
mushroom-slider$: |
.slider {
animation: ping 2s infinite;
}
@keyframes ping {
0% {box-shadow: 0 0 0 0 rgba(var(--rgb-red), 0.7);}
70% {box-shadow: 0 0 0 10px transparent;}
100% {box-shadow: 0 0 0 0 transparent;}
}
.: |
mushroom-light-brightness-control {
padding: 10px;
height: 40px;
}
mushroom-light-color-control {
padding: 10px;
height: 40px;
}
mushroom-light-color-temp-control {
padding: 10px;
height: 40px;
}
Slider Border.
![image](https://community-assets.home-assistant.io/original/4X/2/3/6/2364977ccce9c9f91ac38c1e9abcc309df89bd2e.png)
Maybe add some padding the the box the slider lives in.
card_mod:
style:
mushroom-light-brightness-control$:
mushroom-slider$: |
.slider {
border: dashed blue !important;
}
mushroom-light-color-control$:
mushroom-slider$: |
.slider {
border: dashed blue !important;
}
mushroom-light-color-temp-control$:
mushroom-slider$: |
.slider {
border: dashed blue !important;
}
End of Slider Styling Section
Buttons Styling
If you have control buttons they can be styled like this:
for the light card it seems that nth-child starts at 2 for some reason?
Change the icon type/mdi.
![image](https://community-assets.home-assistant.io/original/4X/b/2/3/b231e0130e81914fe16df965bdf1740136707698.png)
add + 1 to the nth-child for each button in your card. light card starts at 2 for some reason.
card_mod:
style:
mushroom-button:nth-child(2)$: |
.button ::slotted(*) {
--card-mod-icon: mdi:mushroom;
}
Change the icon color.
![image](https://community-assets.home-assistant.io/original/4X/5/8/d/58dbfc216761c7d6fe838ecda0b744331f04fdca.png)
add + 1 to the nth-child for each button in your card. light card starts at 2 for some reason.
card_mod:
style:
mushroom-button:nth-child(2)$: |
.button ::slotted(*) {
--card-mod-icon-color: orange;
}
Change icon size.
![image](https://community-assets.home-assistant.io/original/4X/c/4/2/c4275fc19912ddbffa502e3d978bc84692bfd075.png)
add + 1 to the nth-child for each button in your card. light card starts at 2 for some reason.
card_mod:
style:
mushroom-button:nth-child(2)$: |
.button ::slotted(*) {
--control-icon-size: 50px;
}
Rotate Icon.
![image](https://community-assets.home-assistant.io/original/4X/d/b/c/dbc6f05a20bd8a56a772dab62cadad4ea67a429a.png)
add + 1 to the nth-child for each button in your card. light card starts at 2 for some reason.
card_mod:
style:
mushroom-button:nth-child(2)$: |
.button ::slotted(*) {
rotate: 40deg;
}
Offset/Pad Icon.
![image](https://community-assets.home-assistant.io/original/4X/9/c/d/9cd3e90b990f18b6d6bc570e9728ea4e99c90bd5.png)
add + 1 to the nth-child for each button in your card. light card starts at 2 for some reason.
card_mod:
style:
mushroom-button:nth-child(2)$: |
.button ::slotted(*) {
padding-right: 100px;
padding-left: 10px;
padding-bottom: 20px;
width: 150px;
}
Animate the Icon.
![Untitled video - Made with Clipchamp (50)](https://community-assets.home-assistant.io/original/4X/d/0/b/d0be5800ac3d356db8baff17319417a3c68e7db2.gif)
add + 1 to the nth-child for each button in your card. light card starts at 2 for some reason.
you will need to put your keyframes outside of the ha-icon as per the below.
card_mod:
style:
mushroom-button:nth-child(2)$: |
.button ::slotted(*) {
animation: wobbling 0.7s linear infinite alternate;
}
@keyframes wobbling {
0% {transform: rotate(-80deg);}
100% {transform: rotate(40deg);}
}
Button Background.
![image](https://community-assets.home-assistant.io/original/4X/0/3/6/0362f84632b0b53687634aefd0189e95c79c324c.png)
add + 1 to the nth-child for each button in your card. light card starts at 2 for some reason.
!important seems to be required.
card_mod:
style:
mushroom-button:nth-child(2)$: |
.button {
background: #780000 !important;
}
Button Size.
![image](https://community-assets.home-assistant.io/original/4X/b/5/9/b591a5514feb93bafd5381faaf780adfc3397a7d.png)
add + 1 to the nth-child for each button in your card. light card starts at 2 for some reason.
card_mod:
style: |
mushroom-button:nth-child(2) {
height: 100px !important;
width: 100px !important;
}
Button Location.
![image](https://community-assets.home-assistant.io/original/4X/f/c/1/fc15eb83ada8eb0bd43331f1d723d39e119c15fc.png)
add + 1 to the nth-child for each button in your card. light card starts at 2 for some reason.
Only margin top and left work, but negative values are allowed so you can move them anywhere you please.
card_mod:
style: |
mushroom-button:nth-child(2) {
margin-top: 20px !important;
margin-left: 37px !important;
}
Button Border/Outline.
![image](https://community-assets.home-assistant.io/original/4X/8/7/4/8744d7e0f6ab9f5a9892e701e65a34ee06c758c6.png)
add + 1 to the nth-child for each button in your card. light card starts at 2 for some reason.
border types can be found here.
card_mod:
style:
mushroom-button:nth-child(2) $: |
.button {
border: dashed blue !important;
}
Button Reverse Order.
![image](https://community-assets.home-assistant.io/original/4X/d/d/b/ddbdc2bf2d3f73499cb3fa41ad788bf33436b4eb.png)
this doesnt work very well unless you also move the slider. i have done that in this example.
card_mod:
style:
mushroom-light-color-control$: |
mushroom-slider {
transform: scalex(-1)
}
mushroom-light-color-temp-control$: |
mushroom-slider {
transform: scalex(-1)
}
mushroom-light-brightness-control$: |
mushroom-slider {
transform: scalex(-1)
}
.: |
.actions {
transform: scalex(-1)
}
Animate buttons shape.
![Untitled video - Made with Clipchamp (51)](https://community-assets.home-assistant.io/original/4X/8/2/6/8260b8929a59865525313de9f7daa3ef4e87dbb3.gif)
i would recommend adding some padding to the boxes that the buttons live in just so that there is space for the animation. you will need to put your keyframes outside of the .button, like the below.
card_mod:
style:
mushroom-button:nth-child(1)$: |
.button {
animation: ping 2s infinite;
}
@keyframes ping {
0% {box-shadow: 0 0 0 0 rgba(var(--rgb-red), 0.7);}
70% {box-shadow: 0 0 0 10px transparent;}
100% {box-shadow: 0 0 0 0 transparent;}
}
mushroom-button:nth-child(2)$: |
.button {
animation: ping 2s infinite;
}
@keyframes ping {
0% {box-shadow: 0 0 0 0 rgba(var(--rgb-red), 0.7);}
70% {box-shadow: 0 0 0 10px transparent;}
100% {box-shadow: 0 0 0 0 transparent;}
}
.: |
mushroom-button {
padding: 10px;
height: 40px;
}
End of Buttons Styling Section
End of Light Card Section