From d0327915db79f3b9c64e3da75ee46e9b668264fa Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Mon, 30 Dec 2024 11:49:08 +0100 Subject: [PATCH] View background settings: Change transparancy to opacity (#23450) --- src/data/lovelace/config/view.ts | 2 +- .../editor/view-editor/hui-view-background-editor.ts | 10 +++++----- src/panels/lovelace/views/hui-view-background.ts | 4 ++-- src/translations/en.json | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/data/lovelace/config/view.ts b/src/data/lovelace/config/view.ts index 89a96b1a54f9..915c5545cbf6 100644 --- a/src/data/lovelace/config/view.ts +++ b/src/data/lovelace/config/view.ts @@ -9,7 +9,7 @@ export interface ShowViewConfig { export interface LovelaceViewBackgroundConfig { image?: string; - transparency?: number; + opacity?: number; size?: "auto" | "cover" | "contain"; alignment?: | "top left" diff --git a/src/panels/lovelace/editor/view-editor/hui-view-background-editor.ts b/src/panels/lovelace/editor/view-editor/hui-view-background-editor.ts index ec1a102a8dba..fe5624f2a7fd 100644 --- a/src/panels/lovelace/editor/view-editor/hui-view-background-editor.ts +++ b/src/panels/lovelace/editor/view-editor/hui-view-background-editor.ts @@ -37,7 +37,7 @@ export class HuiViewBackgroundEditor extends LitElement { type: "expandable" as const, schema: [ { - name: "transparency", + name: "opacity", selector: { number: { min: 1, max: 100, mode: "slider" }, }, @@ -117,7 +117,7 @@ export class HuiViewBackgroundEditor extends LitElement { if (!background) { background = { - transparency: 33, + opacity: 33, alignment: "center", size: "cover", repeat: "repeat", @@ -125,7 +125,7 @@ export class HuiViewBackgroundEditor extends LitElement { }; } else { background = { - transparency: 100, + opacity: 100, alignment: "center", size: "cover", repeat: "no-repeat", @@ -162,9 +162,9 @@ export class HuiViewBackgroundEditor extends LitElement { return this.hass.localize( "ui.panel.lovelace.editor.edit_view.background.image" ); - case "transparency": + case "opacity": return this.hass.localize( - "ui.panel.lovelace.editor.edit_view.background.transparency" + "ui.panel.lovelace.editor.edit_view.background.opacity" ); case "alignment": return this.hass.localize( diff --git a/src/panels/lovelace/views/hui-view-background.ts b/src/panels/lovelace/views/hui-view-background.ts index fbb5e933c969..5a065d2650e8 100644 --- a/src/panels/lovelace/views/hui-view-background.ts +++ b/src/panels/lovelace/views/hui-view-background.ts @@ -67,8 +67,8 @@ export class HUIViewBackground extends LitElement { background?: string | LovelaceViewBackgroundConfig ) { if (typeof background === "object" && background.image) { - if (background.transparency) { - return `${background.transparency}%`; + if (background.opacity) { + return `${background.opacity}%`; } } return null; diff --git a/src/translations/en.json b/src/translations/en.json index 59327c196e21..3e4371ab857d 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -5956,7 +5956,7 @@ "bottom right": "Bottom right" } }, - "transparency": "Background transparency", + "opacity": "Background opacity", "repeat": { "name": "Background repeat", "options": {