diff --git a/src/components/icon.ts b/src/components/icon.ts
index e540d3b0..a5d6fd23 100644
--- a/src/components/icon.ts
+++ b/src/components/icon.ts
@@ -1,6 +1,7 @@
import { HomeAssistant } from '@dermotduffy/custom-card-helpers';
import { CSSResultGroup, html, LitElement, TemplateResult, unsafeCSS } from 'lit';
import { customElement, property } from 'lit/decorators.js';
+import { styleMap } from 'lit/directives/style-map.js';
import { IconController } from '../components-lib/icon-controller';
import iconStyle from '../scss/icon.scss';
import { Icon } from '../types';
@@ -17,11 +18,13 @@ export class FrigateCardIcon extends LitElement {
protected render(): TemplateResult {
const customIconURL = this._controller.getCustomIcon(this.icon);
+ const style = styleMap(this.icon?.style || {});
+
if (customIconURL) {
- return html`
`;
+ return html`
`;
}
if (this.icon?.icon) {
- return html``;
+ return html``;
}
if (this.hass && this.icon?.entity) {
const stateObj = this._controller.createStateObjectForStateBadge(
@@ -29,7 +32,11 @@ export class FrigateCardIcon extends LitElement {
this.icon.entity,
);
if (stateObj) {
+ // As a special case, need to pass in a color in order for the state
+ // color to be overridden.
return html``;
+ return html``;
}
return html``;
}
diff --git a/src/components/menu.ts b/src/components/menu.ts
index df47f1d9..64b0259f 100644
--- a/src/components/menu.ts
+++ b/src/components/menu.ts
@@ -81,6 +81,7 @@ export class FrigateCardMenu extends LitElement {
icon: button.icon,
entity: button.entity,
stateColor: button.state_color,
+ style: button.style,
fallback: 'mdi:gesture-tap-button',
}}
>
diff --git a/src/components/submenu.ts b/src/components/submenu.ts
index ff9ce6f8..0b2dfd8c 100644
--- a/src/components/submenu.ts
+++ b/src/components/submenu.ts
@@ -9,7 +9,7 @@ import {
} from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { ifDefined } from 'lit/directives/if-defined.js';
-import { StyleInfo, styleMap } from 'lit/directives/style-map.js';
+import { styleMap } from 'lit/directives/style-map.js';
import { actionHandler } from '../action-handler-directive.js';
import { MenuSubmenu, MenuSubmenuItem, MenuSubmenuSelect } from '../config/types.js';
import submenuStyle from '../scss/submenu.scss';
@@ -69,6 +69,7 @@ export class FrigateCardSubmenu extends LitElement {
.icon=${{
icon: item.icon,
entity: item.entity,
+ style: item.style,
}}
style="${styleMap(item.style || {})}"
>
@@ -81,6 +82,7 @@ export class FrigateCardSubmenu extends LitElement {
return html``;
}
const items = this.submenu.items as MenuSubmenuItem[];
+ const style = styleMap(this.submenu.style || {});
return html`
stopEventFromActivatingCardWideActions(ev)}
>