Forum Discussion
Need help with formating colors based on time in columns
- Nov 08, 2019
I managed with another code to get the result that I wanted, but thanks for the effort!
{ "$schema": "<a href="https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json" target="_blank">https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json</a>", "elmType": "div", "attributes": { "class": "=if(@currentField <= '02:00:00', 'sp-field-severity--good', if(@currentField >= '02:00:00', 'sp-field-severity--blocked', '" }, "children": [ { "elmType": "span", "style": { "display": "inline-block", "padding": "0 4px" }, "attributes": { "iconName": "=if(@currentField <= '02:00:00', 'CheckMark', if(@currentField >= '02:00:00', 'Warning', '" } }, { "elmType": "span", "txtContent": "@currentField" } ] }
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"background-color": "=if(@currentField == 'Completed', 'green', if(@currentField == 'Pending', 'yellow', 'transparent'))",
"color": "white",
"padding": "5px",
"border-radius": "3px",
"text-align": "center"
},
"txtContent": "@currentField"
} Good Afternoon I hope you doing well. Just I need help for this Code in SharePoint. So I want to create background color columns . I used this code but it does not work with me. Can you help me plz