Skip to content

Commit da71fbe

Browse files
authored
Update predbat-table-card.js
fixes to new day dividing line fixes to pill colours in dark mode
1 parent 421b19c commit da71fbe

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

predbat-table-card.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,17 @@ class PredbatTableCard extends HTMLElement {
8080
dividerRow.classList.add('daySplitter');
8181
for(let j = 0; j < columnsToReturn.length; j++) {
8282
let newCell = document.createElement('td');
83-
newCell.style.backgroundColor = "#e1e1e1";
83+
84+
if(this.getLightMode(hass.themes.darkMode)){
85+
newCell.style.backgroundColor = "#e1e1e1";
86+
newCell.style.opacity = 0.4;
87+
} else {
88+
// light mode
89+
newCell.style.backgroundColor = "#2a3240";
90+
newCell.style.opacity = 0.75;
91+
}
92+
8493
newCell.style.height = "1px";
85-
newCell.style.opacity = 0.3;
8694
dividerRow.appendChild(newCell);
8795
}
8896
newTableBody.appendChild(dividerRow);
@@ -299,7 +307,7 @@ class PredbatTableCard extends HTMLElement {
299307

300308
} else {
301309
//console.log("String does not contain '(' or ')'");
302-
newCell.innerHTML = '<div class="iconContainer">' + this.getTransformedCostToPill(theItem) + '</div>';
310+
newCell.innerHTML = '<div class="iconContainer">' + this.getTransformedCostToPill(theItem, darkMode) + '</div>';
303311
}
304312

305313

@@ -363,8 +371,11 @@ class PredbatTableCard extends HTMLElement {
363371
let textColor;
364372
let pillColor = theItem.color;
365373
if(this.getLightMode(darkMode) === true){
374+
// card is dark mode
366375
textColor = this.getDarkenHexColor(theItem.color, 60);
367376
} else {
377+
// card is light mode
378+
console.log("LIGHT MODE IS ACTIVE");
368379
textColor = this.getDarkenHexColor(theItem.color, 70);
369380
pillColor = this.getVibrantColor(theItem.color, 15);
370381
pillColor = this.getLightenHexColor(pillColor, 10);
@@ -501,8 +512,8 @@ class PredbatTableCard extends HTMLElement {
501512
bgColor = "var(--primary-text-color)";
502513

503514
if(this.getLightMode(hassDarkMode) === false ){
504-
// light mode active so adjust the colours from trefor
505515

516+
// light mode active so adjust the colours from trefor
506517
bgColor = this.getDarkenHexColor(bgColor, 30);
507518

508519
}

0 commit comments

Comments
 (0)