Skip to content

Commit

Permalink
View background settings: Change transparancy to opacity (#23450)
Browse files Browse the repository at this point in the history
  • Loading branch information
silamon authored and bramkragten committed Dec 30, 2024
1 parent fea83c0 commit c908272
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/data/lovelace/config/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface ShowViewConfig {

export interface LovelaceViewBackgroundConfig {
image?: string;
transparency?: number;
opacity?: number;
size?: "auto" | "cover" | "contain";
alignment?:
| "top left"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
},
Expand Down Expand Up @@ -117,15 +117,15 @@ export class HuiViewBackgroundEditor extends LitElement {

if (!background) {
background = {
transparency: 33,
opacity: 33,
alignment: "center",
size: "cover",
repeat: "repeat",
attachment: "fixed",
};
} else {
background = {
transparency: 100,
opacity: 100,
alignment: "center",
size: "cover",
repeat: "no-repeat",
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/panels/lovelace/views/hui-view-background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5955,7 +5955,7 @@
"bottom right": "Bottom right"
}
},
"transparency": "Background transparency",
"opacity": "Background opacity",
"repeat": {
"name": "Background repeat",
"options": {
Expand Down

0 comments on commit c908272

Please sign in to comment.