Skip to content

Commit

Permalink
#67 Change defaults of shadow to false, #68 Add darken_image option a…
Browse files Browse the repository at this point in the history
…nd default to false. (#70)
  • Loading branch information
junalmeida authored Apr 13, 2023
1 parent d27a0bc commit 9863739
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ For `tap_action` options, see https://www.home-assistant.io/dashboards/actions/.
entities: #optional, lists area entities automatically if ommited.
- entity: media_player.living_room_tv
state_color: false # enable or disable HA colors for this entity
shadow: true # enable a drop shadow on entity icons to contrast with the background
darken_image: true # reduce brightness of the background image to constrast with entities
- entity: switch.fireplace_on_off
- entity: cover.window_covering
tap_action:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "minimalistic-area-card",
"version": "1.1.11",
"version": "1.1.12",
"description": "Minimalistic Area Card for Home Assistant",
"keywords": [
"home-assistant",
Expand Down
39 changes: 23 additions & 16 deletions src/minimalistic-area-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,26 +187,30 @@ class MinimalisticAreaCard extends LitElement {
hasAction(this.config.hold_action), hasDoubleClick: hasAction(this.config.double_tap_action),
})}
tabindex=${ifDefined(hasAction(this.config.tap_action) ? "0" : undefined)}>
${imageUrl ? html`<img src=${imageUrl} />` : null}
${this.config.camera_image ? html`<div class="camera">
<hui-image .hass=${this.hass} .cameraImage=${this.config.camera_image} .entity=${this.config.camera_image}
.cameraView=${this.config.camera_view || "auto"} .width="100%"></hui-image>
${imageUrl ? html`<img src=${imageUrl} class=${classMap({
"darken"
: this.config.darken_image === undefined ? false : this.config.darken_image,
})} />` : null}
${this.config.camera_image ? html`<div class="camera" class=${classMap({
"darken"
: this.config.darken_image === undefined ? false : this.config.darken_image,
})}>
<hui-image
.hass=${this.hass}
.cameraImage=${this.config.camera_image}
.entity=${this.config.camera_image}
.cameraView=${this.config.camera_view || "auto"}
.width="100%"></hui-image>
</div>` : null}
<div class="box">
<div class="card-header">${this.config.title}</div>
<div class="sensors">
${this._entitiesSensor.map((entityConf) =>
this.renderEntity(entityConf, true, true)
)}
${this._entitiesSensor.map((entityConf) => this.renderEntity(entityConf, true, true))}
</div>
<div class="buttons">
${this._entitiesDialog.map((entityConf) =>
this.renderEntity(entityConf, true, false)
)}
${this._entitiesToggle.map((entityConf) =>
this.renderEntity(entityConf, false, false)
)}
${this._entitiesDialog.map((entityConf) => this.renderEntity(entityConf, true, false))}
${this._entitiesToggle.map((entityConf) => this.renderEntity(entityConf, false, false))}
</div>
</div>
</ha-card>
Expand All @@ -232,7 +236,7 @@ class MinimalisticAreaCard extends LitElement {
<div class="wrapper">
<hui-warning-element .label=${createEntityNotFoundWarning(this.hass, entityConf.entity)} class=${classMap({
"shadow"
: this.config.shadow === undefined ? true : this.config.shadow,
: this.config.shadow === undefined ? false : this.config.shadow,
})}></hui-warning-element>
</div>
`;
Expand Down Expand Up @@ -415,8 +419,7 @@ class MinimalisticAreaCard extends LitElement {
display: block;
height: 100%;
width: 100%;
filter: brightness(0.55);
object-fit: cover;
position: absolute;
Expand All @@ -425,6 +428,10 @@ class MinimalisticAreaCard extends LitElement {
border-radius: var(--ha-card-border-radius, 12px)
}
.darken {
filter: brightness(0.55);
}
div.camera {
height: 100%;
width: 100%;
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface MinimalisticAreaCardConfig extends LovelaceCardConfig {
double_tap_action?: ActionConfig;
shadow?: boolean;
state_color?: boolean;
darken_image?: boolean;
}

export interface HomeAssistantArea {
Expand Down

0 comments on commit 9863739

Please sign in to comment.