Conditional formatting of a table

I would like to colour each cell of a table column on the base of some conditions.
The field of interest is a date; I have three conditions and so three possible colours to assign.
I want to assign one of the three colours to the cell of the table according to the verified condition.

Ex. Red if rowdata> date()
Orange if rowdate is 5 days before today date.
Green if rowdate is more than 5 days with respect to the today date.

Thanks for you suggestion and help

You need to specify how you are showing the table.

This is the header of the table:

My first option is to colour the field 'Data Scadenza' according to some conditions.
If this is not possible, I can add the column Colour Status and colour this cell according to the conditions that must be verified.


Yes, but is this using Dashboard? the ui_table node? ... With Node-RED, there are many ways to provide UI's.

Yes, I'm using this table node

It is best, when looking for help in the forum, to be explicit as to what node you are using. There are thousands and it can be hard for people to know.

The information on that node tells you what you need in order to be able to style it further.

Thanks for suggestion.
I have already found this link, but I was looking for somenthing more practical, some specific example on how to insert a conditional formatting on the column data according to some conditions.


You will find examples on the website for the underlying table tool. I don't use this myself so I cant be more specific.

Look in the projects section of the forum for my ‘ETPhone home’ project. In it I change the color of cells based on data in one of the columns of the row.

Do you mean this project?

ET-Display-Home V1.0.2

Yes, sorry I was out and about when I posted and forgot to check it when I got back.

Thanks Zenofmud,

could you indicate me in which flow? It is a big project, so maybe you can address me where to have a look to find it easily.

many thanks

Look at the 'Dashboard' tab and the ui-template node labeled 'ESP8266 configured devices'

Hi zenofmud,
I'm following your example for background colour, very useful.
In one column of my table, I put an expiration date.
I need to compare this date with respect to the today date. Is it possible to insert a condition based on a date?
(for example something similar to: if = x.DATASCADENZA < date() -> assign class="warning_green")

If I compare with an exact date I have seen that works (" td ng-if="x.DATASCADENZA ='2022-04-03' " class="warning_green" >{{x.DATASCADENZA}}"

Could you help me to solve this?

Thank in advance

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.