View background settings: Change transparancy to opacity (#23450)

This commit is contained in:
Simon Lamon 2024-12-30 11:49:08 +01:00 committed by Bram Kragten
parent fea83c0873
commit c9082724a8
4 changed files with 9 additions and 9 deletions

View File

@ -9,7 +9,7 @@ export interface ShowViewConfig {
export interface LovelaceViewBackgroundConfig { export interface LovelaceViewBackgroundConfig {
image?: string; image?: string;
transparency?: number; opacity?: number;
size?: "auto" | "cover" | "contain"; size?: "auto" | "cover" | "contain";
alignment?: alignment?:
| "top left" | "top left"

View File

@ -37,7 +37,7 @@ export class HuiViewBackgroundEditor extends LitElement {
type: "expandable" as const, type: "expandable" as const,
schema: [ schema: [
{ {
name: "transparency", name: "opacity",
selector: { selector: {
number: { min: 1, max: 100, mode: "slider" }, number: { min: 1, max: 100, mode: "slider" },
}, },
@ -117,7 +117,7 @@ export class HuiViewBackgroundEditor extends LitElement {
if (!background) { if (!background) {
background = { background = {
transparency: 33, opacity: 33,
alignment: "center", alignment: "center",
size: "cover", size: "cover",
repeat: "repeat", repeat: "repeat",
@ -125,7 +125,7 @@ export class HuiViewBackgroundEditor extends LitElement {
}; };
} else { } else {
background = { background = {
transparency: 100, opacity: 100,
alignment: "center", alignment: "center",
size: "cover", size: "cover",
repeat: "no-repeat", repeat: "no-repeat",
@ -162,9 +162,9 @@ export class HuiViewBackgroundEditor extends LitElement {
return this.hass.localize( return this.hass.localize(
"ui.panel.lovelace.editor.edit_view.background.image" "ui.panel.lovelace.editor.edit_view.background.image"
); );
case "transparency": case "opacity":
return this.hass.localize( return this.hass.localize(
"ui.panel.lovelace.editor.edit_view.background.transparency" "ui.panel.lovelace.editor.edit_view.background.opacity"
); );
case "alignment": case "alignment":
return this.hass.localize( return this.hass.localize(

View File

@ -67,8 +67,8 @@ export class HUIViewBackground extends LitElement {
background?: string | LovelaceViewBackgroundConfig background?: string | LovelaceViewBackgroundConfig
) { ) {
if (typeof background === "object" && background.image) { if (typeof background === "object" && background.image) {
if (background.transparency) { if (background.opacity) {
return `${background.transparency}%`; return `${background.opacity}%`;
} }
} }
return null; return null;

View File

@ -5955,7 +5955,7 @@
"bottom right": "Bottom right" "bottom right": "Bottom right"
} }
}, },
"transparency": "Background transparency", "opacity": "Background opacity",
"repeat": { "repeat": {
"name": "Background repeat", "name": "Background repeat",
"options": { "options": {