mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Only use custom color when active on tile card (#14744)
This commit is contained in:
parent
2d7973af79
commit
62bc171b8c
@ -9,6 +9,7 @@ import { hsv2rgb, rgb2hsv } from "../../../common/color/convert-color";
|
||||
import { DOMAINS_TOGGLE } from "../../../common/const";
|
||||
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||
import { computeStateDisplay } from "../../../common/entity/compute_state_display";
|
||||
import { stateActive } from "../../../common/entity/state_active";
|
||||
import { stateColorCss } from "../../../common/entity/state_color";
|
||||
import { stateIconPath } from "../../../common/entity/state_icon_path";
|
||||
import { blankBeforePercent } from "../../../common/translations/blank_before_percent";
|
||||
@ -128,9 +129,9 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
|
||||
}
|
||||
|
||||
private _computeStateColor = memoize((entity: HassEntity, color?: string) => {
|
||||
// Use custom color
|
||||
// Use custom color if active
|
||||
if (color) {
|
||||
return computeRgbColor(color);
|
||||
return stateActive(entity) ? computeRgbColor(color) : undefined;
|
||||
}
|
||||
|
||||
// Use default color for person/device_tracker because color is on the badge
|
||||
@ -363,7 +364,7 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
|
||||
static get styles(): CSSResultGroup {
|
||||
return css`
|
||||
:host {
|
||||
--tile-color: var(--rgb-state-default-color);
|
||||
--tile-color: var(--rgb-state-inactive-color);
|
||||
--tile-tap-padding: 6px;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user