Forum Discussion

Peki72's avatar
Peki72
Copper Contributor
Mar 28, 2024

How to change the background color of a list to red with JSON?

How to change the background color of a list to red with JSON ? THis is what i have:

{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json", "additionalRowClass": "=if(@rowIndex % 2 == 0,'ms-bgColor-communicationTint40 ms-bgColor-communicationTint30--hover','ms-bgColor-white')" }

But i need also the background color of the list to red How can i do that?

Gr. P

  • Peki72 Unfortunately, you cannot change the background color "whole" list using SharePoint JSON view formatting.

     

    You can only change the background color of individual rows (items) in the SharePoint list.

     

    You can use JSON like below for changing the background color of "rows" to red: 

     

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
      "additionalRowClass": "=if(@rowIndex % 2 == 0,'ms-bgColor-red ms-bgColor-redDark--hover','ms-bgColor-white')"
    }

     

    More information at: How to change the background color of a list to red with JSON? 


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

  • Peki72 Unfortunately, you cannot change the background color "whole" list using SharePoint JSON view formatting.

     

    You can only change the background color of individual rows (items) in the SharePoint list.

     

    You can use JSON like below for changing the background color of "rows" to red: 

     

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
      "additionalRowClass": "=if(@rowIndex % 2 == 0,'ms-bgColor-red ms-bgColor-redDark--hover','ms-bgColor-white')"
    }

     

    More information at: How to change the background color of a list to red with JSON? 


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

Resources