Changing text colour based on value

Hi,
I have googled/read lots of posts on this forum but I am unable to get this to work!

I am using the DVLA integration which returns the vehicle MOT and Tax expiry dates in year, month, day (ie 2025-05-31) I would like the dashboard card text to be green normally but when there is less than a month until expiry the text changes to orange, then if it is overdue the text changes to red.

I am able to get the text to change if is only a number (ie 80 ) but I cannot get it to work with a date.

Can anyone help / point me in the right direction?

Regards
James

It is usually done by card-mod.

Ask in the main card-mod thread and get ready to show your attempt for

because your unsolved part

will be merely a matter of a proper jinja template.