Column Summary Color Total - Change Color on Value

It is simple to set a display rule that says if the column value is greater than or equal to 0, then the color of the value should be green. And if it is less than 0, it should be red. But I would like this same rule to be applied to the column summary (when Total is selected).

I am thinking this should be done via javascript as the color change is based on a condition rule. I just don’t know how to do it. Anyone ever do this?

You can use something like this…

$(document).on("knack-records-render.view_xx", function (event, view, records) {
    $("#view_xx").find("table > tbody > tr.kn-table_summary").each(function () {
        $(this).find("td").each(function () {
            if (parseInt($(this).text().trim()) > 0) {
                $(this).attr("style", $(this).attr("style") + "background-color: #00ff00;")
            } else if (parseInt($(this).text().trim()) < 0) {
                $(this).attr("style", $(this).attr("style") + "background-color: #ff0000;")
            }
        });
    });
});