Reputation: 1
I am trying to get the header of a sharepoint submission form to change color based on what a status says.
I sas able to get the header to contain the status ex: In progress and the reservation # as pictured, but I cannot get the background of the header color to change based on the status
I cannot get the code to work any help would be greatly appreciated code part 4 is what I am trying to get the color to change
Thanks
I cannot get the color to change I provided pictures of the code
Upvotes: 0
Views: 492
Reputation: 141
Can you provide the code (in text form)? I can try to modify your code for you. I did a test to simulate your scene, and I found that the color you used could not be recognized. I used the officially supported color, which can change the background color according to the value of the state. Here is code for your reference:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if([$Status] =='Not Started' , 'grey', if([$Status] == 'In Progress' ,'#0078d4', 'green'))",
"padding-left": "14px"
}
}
Here is link about color for your reference: https://learn.microsoft.com/en-us/sharepoint/dev/design/themes-colors
Upvotes: 2