1

So I have a SharePoint list with a column called modified. I used the following code to change the rows colors based on when it was last modified which works fine:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
  "additionalRowClass": "=if([$Modified] < @now && [$Modified] >= @now - 86400000, 'sp-field-severity--blocked', if([$Modified] < @now && [$Modified] >= @now - 259200000, 'sp-field-severity--warning' , ''))"
}

However, now I want it to be a dark grayish color instead of red. I have tried many different things, but cannot get it too work for some reason.

1 Answer 1

1

Try something like below:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
  "additionalRowClass": "=if([$Modified] < @now && [$Modified] >= @now - 86400000, 'ms-bgColor-gray120', if([$Modified] < @now && [$Modified] >= @now - 259200000, 'sp-field-severity--warning' , ''))"
}

This will apply ms-bgColor-gray120 class for first condition ([$Modified] < @now && [$Modified] >= @now - 86400000).

Similarly, you can apply any of the predefined classes given in below links as per your requirements:

  1. Predefined classes
  2. Reusable SharePoint Online Classes for Modern UI
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.