@@ -1123,8 +1123,6 @@ class PredbatTableCard extends HTMLElement {
11231123
11241124 let dischargeString = "Export" ;
11251125
1126- //console.log("1: " + dischargeString);
1127-
11281126 if ( this . isSmallScreen ( ) && ( this . config . use_friendly_states === false || this . config . use_friendly_states === undefined ) ) {
11291127
11301128 if ( theItem . value === "Both" ) {
@@ -1139,9 +1137,6 @@ class PredbatTableCard extends HTMLElement {
11391137 newCell . style . minWidth = "110px" ;
11401138 }
11411139
1142- //console.log("2: " + dischargeString);
1143-
1144-
11451140 if ( this . config . use_friendly_states === true && this . isSmallScreen ( ) === false ) {
11461141 if ( theItem . value === "Both" )
11471142 chargeString = "Planned Charge" ;
@@ -1163,13 +1158,11 @@ class PredbatTableCard extends HTMLElement {
11631158 newCell . style . minWidth = "110px" ;
11641159 }
11651160
1166- //console.log("3: " + dischargeString);
1167-
11681161 let chargeBackgroundColor = "background-color:#3AEE85;" ;
11691162 let chargeTextColor = "color: #000000;" ;
11701163 if ( theItem . value === "Both-Idle" || theItem . value === "Both-Dis" || theItem . value === "Both-Chg" || theItem . value === "Both-Dis-Snail" ) {
1171- chargeBackgroundColor = "background-color:#FFFFFF ;" ;
1172- chargeTextColor = "" ;
1164+ chargeBackgroundColor = "background-color:transparent ;" ;
1165+ chargeTextColor = "color: var(--primary-text-color) " ;
11731166 }
11741167 let chargeIcon ;
11751168 if ( theItem . value === "Both" || theItem . value === "Both-Chg" )
@@ -1183,7 +1176,6 @@ class PredbatTableCard extends HTMLElement {
11831176 if ( theItem . value === "Both-Dis-Snail" )
11841177 snail = `<ha-icon icon="mdi:snail" title="Low Power Mode" style="--mdc-icon-size: 14px;"></ha-icon>` ;
11851178
1186-
11871179 return `<div style="width: 100%; height: 100%;" id="${ theItem . value } ">
11881180 <div style='${ chargeBackgroundColor } width: 50%; height: 100%; float: left; display: flex; align-items: center; justify-content: center; ${ chargeTextColor } '>${ chargeString } ${ chargeIcon } </div>
11891181 <div style='background-color:#FFFF00; width: 50%; height: 100%; float: left; display: flex; align-items: center; justify-content: center; color: #000000;'>${ dischargeString } <ha-icon icon="mdi:arrow-down-thin" style="margin: 0 0 0 -5px"></ha-icon>${ snail } </div>
@@ -1209,14 +1201,18 @@ class PredbatTableCard extends HTMLElement {
12091201 'weather-column' , 'rain-column' , 'temp-column' , 'state-column' , 'cost-column' , 'options-column' , 'options-popup-column' ,
12101202 'pv-column' , 'import-export-column' , 'car-column' ] ;
12111203
1204+ const bothValues = [ "Both" , "Both-Idle" , "Both-Chg" , "Both-Dis" , "Both-Dis-Snail" ] ;
1205+ const isBothField = bothValues . includes ( theItem . value ) ;
1206+
12121207 // This var will be used to collect the different parts of the response and build at the end.
12131208 let cellResponseArray = [ ] ;
12141209
12151210 // Old Skool Configuration
12161211
12171212 let useOldSkool = false ;
12181213 if ( ( this . config . old_skool || this . config . old_skool_columns ?. includes ( column ) ) && ! isNonDataColumn ) {
1219- newCell . style . backgroundColor = theItem . color ;
1214+ if ( ! isBothField )
1215+ newCell . style . backgroundColor = theItem . color ;
12201216 if ( theItem . color )
12211217 newCell . style . color = "#000000" ;
12221218 useOldSkool = true ;
@@ -1466,9 +1462,9 @@ class PredbatTableCard extends HTMLElement {
14661462 priceStrings = this . getPricesFromPriceString ( contentWithoutTags , hasBoldTags , hasItalicTags , false ) ;
14671463
14681464 if ( this . config . stack_pills === false ) {
1469- newCell . innerHTML = '<div class="iconContainer">' + this . getTransformedCostToPill ( { "value" :priceStrings [ 0 ] , "color" :theItem . color } , darkMode )
1465+ cellResponseArray . push ( '<div class="iconContainer">' + this . getTransformedCostToPill ( { "value" :priceStrings [ 0 ] , "color" :theItem . color } , darkMode )
14701466 + this . getTransformedCostToPill ( { "value" :priceStrings [ 1 ] , "color" :theItem . color } , darkMode )
1471- + '</div>' ;
1467+ + '</div>' ) ;
14721468 } else {
14731469 newPills += '<div style="height: 26px; align-items: center;">' + this . getTransformedCostToPill ( { "value" :priceStrings [ 0 ] , "color" :theItem . color } , darkMode ) + '</div>' ;
14741470 newPills += '<div style="height: 26px; align-items: center;">' + this . getTransformedCostToPill ( { "value" :priceStrings [ 1 ] , "color" :theItem . color } , darkMode ) + '</div>' ;
@@ -1512,9 +1508,7 @@ class PredbatTableCard extends HTMLElement {
15121508 if ( column === "state-column" ) {
15131509
15141510 let stateText ;
1515- const bothValues = [ "Both" , "Both-Idle" , "Both-Chg" , "Both-Dis" , "Both-Dis-Snail" ] ;
1516- const isBothField = bothValues . includes ( theItem . value ) ;
1517-
1511+
15181512 if ( useOldSkool ) {
15191513
15201514 if ( isBothField ) {
@@ -1529,8 +1523,6 @@ class PredbatTableCard extends HTMLElement {
15291523 stateText = this . getFriendlyNamesForState ( theItem . value ) ;
15301524
15311525 cellResponseArray = this . replaceArrowsWithIcons ( theItem . value ) ;
1532-
1533- //if(this.config.use_friendly_states)
15341526 cellResponseArray [ 0 ] = stateText ;
15351527 }
15361528 } else {
@@ -1630,19 +1622,6 @@ class PredbatTableCard extends HTMLElement {
16301622
16311623 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16321624
1633- // Export Column export-column
1634-
1635- if ( column === "export-column" && ! useOldSkool ) {
1636-
1637- // If not oldSkool do something different
1638- if ( ! useOldSkool ) {
1639-
1640- }
1641-
1642- }
1643-
1644- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1645-
16461625 // PV Column pv-column
16471626
16481627 if ( column === 'pv-column' ) {
@@ -1767,6 +1746,9 @@ class PredbatTableCard extends HTMLElement {
17671746 newCell . style . color = "var(--primary-text-color)" ;
17681747 else
17691748 newCell . style . color = theItem . color ;
1749+
1750+ if ( darkMode && useOldSkool )
1751+ newCell . style . color = "#000000" ;
17701752 }
17711753
17721754 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0 commit comments