I am trying to change the background color of each row in SharePoint list on office 365. I have been looking online for two days there are so many solutions and most of them don't work on new list experience. My main objective to conditional format a row based on a value of a status column. can someone help me with this?
1 Answer
Yes, it is possible.
You can use View Formatting in Office 365 to color the rows based on the Status field.
Use below JSON code to color the rows in your list:
{
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if([$Status] == 'Done', 'sp-field-severity--good', if([$Status] == 'In progress', 'sp-field-severity--low' ,if([$Status] == 'In review','sp-field-severity--warning', if([$Status] == 'Has issues','sp-field-severity--blocked', ''))))"
}
You can put above code by selecting Format current view option as given below:
Reference: 1. Use view formatting to customize SharePoint.
Update:
To use customized colors and formatting you need to use rowFormatter
in JSON formatting:
You can find view samples on GitHub.
-
sorry I wasn't clear with my question. I need specific color not predefined color . is this possible? Commented Mar 12, 2019 at 5:44
-
-
in this case, you need to use
rowFormatter
. check updated answer. Commented Mar 12, 2019 at 6:21 -
I need to do this for several lists. I need to have at least 20 different colors. Commented Mar 12, 2019 at 21:49
-
You need to add the json code in each list separately. Commented Mar 13, 2019 at 3:03