'How to customize the color of the JSON additionalRowClass in SharePoint Online?

I'm currently try to format the rows of a SharePoint Online list depending on a specific lookup Value. This works so far, but I need to know how I can use custom colors and not the predefined colours of Microsoft. E.g. #FF0000 instead of "sp-field-severity--warning" or how can I use my own class for the entire row and not just one field.

{ "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json", "additionalRowClass": "=if([$Status.lookupValue] == 'in progress', 'sp-field-severity--good', if([$Status.lookupValue] == 'on hold','sp-field-severity--warning', ''))" }

Best regards

Matthias

I try to customized the JSON so far, but I don't know where I can add the custom color codes in HEX or RGB.

Thanks in advance



Solution 1:[1]

Per my test we are not able to add RGB code to format view. But you could use ms-bgColor-[color] instead of "sp-field-severity--warning" to change the color of a row.

For Reference: MVP Article – Using Theme Colors in List Formatting

My test result:

{
   "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
   "additionalRowClass": "=if([$choice] == 'READY TO GO', 'ms-bgColor-sharedRed10', if([$choice] == 'NEW','ms-bgColor-sharedGreen10', ''))" 
}

color.jpg

And here is a blog about different ms-bgColor-[color].

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Casey Yang - MSFT