mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
Add the options dark_mode_filter and dark_mode_image to the picture elements card (#7304)
This commit is contained in:
parent
ce07dfd8ac
commit
213c53e307
@ -129,6 +129,8 @@ class HuiPictureElementsCard extends LitElement implements LovelaceCard {
|
|||||||
.cameraView=${this._config.camera_view}
|
.cameraView=${this._config.camera_view}
|
||||||
.entity=${this._config.entity}
|
.entity=${this._config.entity}
|
||||||
.aspectRatio=${this._config.aspect_ratio}
|
.aspectRatio=${this._config.aspect_ratio}
|
||||||
|
.darkModeFilter=${this._config.dark_mode_filter}
|
||||||
|
.darkModeImage=${this._config.dark_mode_image}
|
||||||
></hui-image>
|
></hui-image>
|
||||||
${this._elements}
|
${this._elements}
|
||||||
</div>
|
</div>
|
||||||
|
@ -218,6 +218,8 @@ export interface PictureElementsCardConfig extends LovelaceCardConfig {
|
|||||||
entity?: string;
|
entity?: string;
|
||||||
elements: LovelaceElementConfig[];
|
elements: LovelaceElementConfig[];
|
||||||
theme?: string;
|
theme?: string;
|
||||||
|
dark_mode_image?: string;
|
||||||
|
dark_mode_filter?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PictureEntityCardConfig extends LovelaceCardConfig {
|
export interface PictureEntityCardConfig extends LovelaceCardConfig {
|
||||||
|
@ -46,6 +46,10 @@ export class HuiImage extends LitElement {
|
|||||||
|
|
||||||
@property() public stateFilter?: StateSpecificConfig;
|
@property() public stateFilter?: StateSpecificConfig;
|
||||||
|
|
||||||
|
@property() public darkModeImage?: string;
|
||||||
|
|
||||||
|
@property() public darkModeFilter?: string;
|
||||||
|
|
||||||
@internalProperty() private _loadError?: boolean;
|
@internalProperty() private _loadError?: boolean;
|
||||||
|
|
||||||
@internalProperty() private _cameraImageSrc?: string;
|
@internalProperty() private _cameraImageSrc?: string;
|
||||||
@ -97,6 +101,8 @@ export class HuiImage extends LitElement {
|
|||||||
imageSrc = this.image;
|
imageSrc = this.image;
|
||||||
imageFallback = true;
|
imageFallback = true;
|
||||||
}
|
}
|
||||||
|
} else if (this.darkModeImage && this.hass.themes.darkMode) {
|
||||||
|
imageSrc = this.darkModeImage;
|
||||||
} else {
|
} else {
|
||||||
imageSrc = this.image;
|
imageSrc = this.image;
|
||||||
}
|
}
|
||||||
@ -108,8 +114,12 @@ export class HuiImage extends LitElement {
|
|||||||
// Figure out filter to use
|
// Figure out filter to use
|
||||||
let filter = this.filter || "";
|
let filter = this.filter || "";
|
||||||
|
|
||||||
|
if (this.hass.themes.darkMode && this.darkModeFilter) {
|
||||||
|
filter += this.darkModeFilter;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.stateFilter && this.stateFilter[state]) {
|
if (this.stateFilter && this.stateFilter[state]) {
|
||||||
filter = this.stateFilter[state];
|
filter += this.stateFilter[state];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filter && this.entity) {
|
if (!filter && this.entity) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user