Changing font color in table

Product: PowerShell Universal
Version: 5.5.2
New-UDTable -Id 'table_maintable' -Data $mainTableData -Columns $tableColumns -ShowRefresh -ShowSearch -ShowFilter -ShowExport -ShowSort -Title 'Main Table' -OnRowStyle {
    if ((get-date $EventData.DateTime) -lt (Get-Date)){
        @{
            'backgroundColor' = 'red'
        }
    }
    elseif(((get-date $EventData.DateTime) - (Get-Date)).totalhours -lt $warningLimit){
        $bgColor = 'yellow'
        $fontColor = 'black'
        @{ 
            'backgroundColor' = $bgColor
            'color' = $fontColor 
        }
    }
}

Hi all! New to these parts. Hoping to get some help or examples on formatting in a table. As you can see in the code block, I’m trying to format the rows of the table depending on the data of the row. The background color works great and results in either yellow or red as it is supposed to, but I can’t figure out how to change the text color. I thought maybe conflict with theme? I did some googling and tried adding ‘black !important’ but that had no effect. I also tried different attribute names for color like fontcolor, font-color, but that also had no effect. Only reason I’m trying to change the text color is because while in darkmode theme, the white text is impossible to see with the yellow background. TIA!

the cmdlet docs show Row Styling|You can style rows by using the -OnRowStyle parameter. The script block will be passed the row data as a hashtable in the $EventData variable. The script block should return a hashtable of CSS styles to apply to the row.. So you are in the ballpark for sure. I’ve not done it, but there is an older forum post about it that might help:

https://forums.ironmansoftware.com/t/coloring-elements-in-a-table-based-on-a-property/57