Skip to content

Commit

Permalink
Update README.md - Fix laundry card code (issue ollo69#425)
Browse files Browse the repository at this point in the history
Changed laundry card colors to make it work after 2022.12 update.
  • Loading branch information
mhu1987 authored Jan 1, 2023
1 parent 6ac01a6 commit fc312bd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,31 +214,31 @@ class LaundryCard extends HTMLElement {
</ha-card>
`;
this.querySelector(".main").style.display = "grid";
this.querySelector(".main").style.gridTemplateColumns = "33% 66%";
this.querySelector("ha-icon").style.setProperty("--mdc-icon-size", "100%");
this.querySelector(".main").style.gridTemplateColumns = "33% 64%";
this.querySelector("ha-icon").style.setProperty("--mdc-icon-size", "95%");
}
if (state.state == "on") {
const totalTime = state.attributes["initial_time"];
const remainTime = state.attributes["remain_time"];
const totalMinutes = (parseInt(totalTime.split(":")[0]) * 60) + parseInt(totalTime.split(":")[1]);
const remainMinutes = (parseInt(remainTime.split(":")[0]) * 60) + parseInt(remainTime.split(":")[1]);
this.querySelector("ha-icon").style.color = "var(--paper-item-icon-active-color)";
this.querySelector("ha-icon").style.color = "#FDD835";
this.querySelector("span").innerHTML = `
${friendlyName} is running ${state.attributes["current_course"]}<br>
Currently ${state.attributes["run_state"]}<br>
${state.attributes["initial_time"]} total, ${state.attributes["remain_time"]} to go
<div class="progress-wrapper" style="height: 20px; width: 100%;">
<div class="progress" style="display: inline-block; height: 20px;">
</div>
<span style="color: var(--paper-item-icon-color); position: absolute; right: 33%;">50%</span>
<span style="color: #FFFFFF; position: absolute; right: 33%;">50%</span>
</div>
`;
this.querySelector(".progress-wrapper").style.backgroundColor = "var(--paper-item-icon-color)";
this.querySelector(".progress").style.backgroundColor = "var(--paper-item-icon-active-color)";
this.querySelector(".progress-wrapper").style.backgroundColor = "#44739E";
this.querySelector(".progress").style.backgroundColor = "#FDD835";
this.querySelector(".progress").style.width = (totalMinutes - remainMinutes) / totalMinutes * 100 + "%";
this.querySelector(".progress-wrapper span").innerHTML = Math.round((totalMinutes - remainMinutes) / totalMinutes * 100) + "%";
} else {
this.querySelector("ha-icon").style.color = "var(--paper-item-icon-color)";
this.querySelector("ha-icon").style.color = "#44739E";
this.querySelector("span").innerHTML = `${friendlyName} is off`;
}
}
Expand Down

0 comments on commit fc312bd

Please sign in to comment.