Skip to content

Commit d032791

Browse files
authored
View background settings: Change transparancy to opacity (#23450)
1 parent 351d318 commit d032791

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/data/lovelace/config/view.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface ShowViewConfig {
99

1010
export interface LovelaceViewBackgroundConfig {
1111
image?: string;
12-
transparency?: number;
12+
opacity?: number;
1313
size?: "auto" | "cover" | "contain";
1414
alignment?:
1515
| "top left"

src/panels/lovelace/editor/view-editor/hui-view-background-editor.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class HuiViewBackgroundEditor extends LitElement {
3737
type: "expandable" as const,
3838
schema: [
3939
{
40-
name: "transparency",
40+
name: "opacity",
4141
selector: {
4242
number: { min: 1, max: 100, mode: "slider" },
4343
},
@@ -117,15 +117,15 @@ export class HuiViewBackgroundEditor extends LitElement {
117117

118118
if (!background) {
119119
background = {
120-
transparency: 33,
120+
opacity: 33,
121121
alignment: "center",
122122
size: "cover",
123123
repeat: "repeat",
124124
attachment: "fixed",
125125
};
126126
} else {
127127
background = {
128-
transparency: 100,
128+
opacity: 100,
129129
alignment: "center",
130130
size: "cover",
131131
repeat: "no-repeat",
@@ -162,9 +162,9 @@ export class HuiViewBackgroundEditor extends LitElement {
162162
return this.hass.localize(
163163
"ui.panel.lovelace.editor.edit_view.background.image"
164164
);
165-
case "transparency":
165+
case "opacity":
166166
return this.hass.localize(
167-
"ui.panel.lovelace.editor.edit_view.background.transparency"
167+
"ui.panel.lovelace.editor.edit_view.background.opacity"
168168
);
169169
case "alignment":
170170
return this.hass.localize(

src/panels/lovelace/views/hui-view-background.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export class HUIViewBackground extends LitElement {
6767
background?: string | LovelaceViewBackgroundConfig
6868
) {
6969
if (typeof background === "object" && background.image) {
70-
if (background.transparency) {
71-
return `${background.transparency}%`;
70+
if (background.opacity) {
71+
return `${background.opacity}%`;
7272
}
7373
}
7474
return null;

src/translations/en.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5956,7 +5956,7 @@
59565956
"bottom right": "Bottom right"
59575957
}
59585958
},
5959-
"transparency": "Background transparency",
5959+
"opacity": "Background opacity",
59605960
"repeat": {
59615961
"name": "Background repeat",
59625962
"options": {

0 commit comments

Comments
 (0)