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 {
image?: string;
transparency?: number;
opacity?: number;
size?: "auto" | "cover" | "contain";
alignment?:
| "top left"

View File

@ -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(

View File

@ -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;

View File

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