Forum Discussion
Jamesod
Jul 20, 2025Copper Contributor
SharePoint List color changes based on date
Hi all, I've been struggling for ages now to get JSON that works in SharePoint Lists. What I'm trying to achieve is a color background to the date text Green: 30+ days from today Orange: wit...
PankajBadoni
Jul 29, 2025Iron Contributor
Apply the below JSON in the column format settings of a date column. While there are other approaches available, this one works reliably for my project.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"background-color": "=if(@currentField < @now, '#f44336', if((Number(@currentField) - Number(@now)) <= 2592000000, '#ff9800', '#4caf50'))",
"color": "white",
"padding": "6px",
"border-radius": "4px",
"text-align": "center"
},
"children": [
{
"elmType": "span",
"txtContent": "@currentField"
}
]
}