I am trying to format the color of a column based on the selection of another column in the same View. But, I am having trouble writing the JSON to check for multiple values in the other column. Here is my code so far that only checks for one selection, "Red". I want it to check for the other possible options, which are "Green", "Blue", "Amber", and "Gray".
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if([$OtherColumn] == 'Red', 'red', '')"
}
}