Forum Discussion

Dave0673's avatar
Dave0673
Copper Contributor
Aug 07, 2019

Quick question: Can I add custom colors to the View Formatting?

Edit: This is on Sharepoint Online using modern experience.

 

I have custom JSON in a list to color code the row based on one column. The only colors I have been able to make work are the colors from the https://developer.microsoft.com/en-us/fabric#/styles/web/colors/theme-slots. I want to make the colors a little more transparent. Here is my current code:

 

{
  "$schema": "<a href="https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json" target="_blank">https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json</a>",
   "additionalRowClass": "=if([$Status] == 'Status1', 'ms-bgColor-greenLight',
                           if([$Status] == 'Status2', 'ms-bgColor-neutralQuaternaryAlt', 
                           if([$Status] == 'Status3', 'ms-bgColor-red ms-fontColor-black, false)))"
}

 

 I tried adding the following before "additionalRowClass" ... and changing the Status1 if statement to 'greenLight', but that didn't work.

 

"greenLight": [16, 124, 16, 0.2],

 

I'm no pro in JSON, but I have read through all these Schemas and I can't find and reference or definition to colors what so ever.

 

Thank you for any help you can provide.

Resources