I have no experience with JSON and have been trying to conditionally format a column to display certain colors depending on the value. The code I found below has worked for me when I tested it, but I'm wondering if there's a way to make it so several values display the same color (there are 11 choices for my column, and I'm trying to make it so 5 choices of the column are yellow, 4 are green, 1 is blue and 1 is red). Is there a simple way to add those choices in to display each color or do I have to add a new set of lines for each? And if I do have to add a set of lines for each choice, what is the proper syntax for that (I have tried unsuccessfully)?
{
"elmType": "div",
"txtContent": "@currentField",
"style": {
"color": "#fff",
"padding-left": "14px",
"background-color": {
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"@currentField",
"Green"
]
},
"#2ECC71",
{
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"@currentField",
"Red"
]
},
"#E74C3C",
{
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"@currentField",
"Yellow"
]
},
"#F1C40F",
{
"operator": "?",
"operands": [
{
"operator": "==",
"operands": [
"@currentField",
"Blue"
]
},
"#76448A",
""
]
}
]
}
]
}
]
}
}
}
''
in the last condition) to see what's being applied.