Forum Discussion
gabsmertes
Jul 18, 2024Copper Contributor
Custom Coloring for SharePoint List Pills
Hello!
Not great at coding but hoping somebody can help. I have a SharePoint that I'd like to custom color the choice pills based on the hex codes below.
1-CORP | #67a3c7 |
5-MPE | #5f497a |
6-THETIS | #e5bd00 |
10-ENERGY | #829900 |
11-MPI | #6a1532 |
14-MUSI | #0b2e6a |
15-MPLI | #0b5b58 |
18-MUCI | #c88ca4 |
20-MICON | #8bc19f |
21-MCI | #ff7b2e |
22-AMI | #0a7e8c |
24-MRSI | #7f5c33 |
26-MTI | #bf4f51 |
60-MTG | #a43482 |
61-JDH | #4f2cd0 |
101-MTPL | #9c7c38 |
201-MTCI | #005b39 |
202-MCJV | #902d0e |
AC | #a6a6a6 |
This is the current JSON in the list:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"flex-wrap": "wrap",
"display": "flex"
},
"children": [
{
"elmType": "div",
"style": {
"box-sizing": "border-box",
"padding": "4px 8px 5px 8px",
"overflow": "hidden",
"text-overflow": "ellipsis",
"display": "flex",
"border-radius": "16px",
"height": "24px",
"align-items": "center",
"white-space": "nowrap",
"margin": "4px 4px 4px 4px"
},
"attributes": {
"class": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"1-CORP"
]
},
"sp-css-backgroundColor-BgCornflowerBlue sp-css-color-CornflowerBlueFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"5-MPE"
]
},
"sp-css-backgroundColor-BgMintGreen sp-css-color-MintGreenFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"6-THETIS"
]
},
"sp-css-backgroundColor-BgGold sp-css-color-GoldFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
""
]
},
"",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"10-MEG"
]
},
"sp-css-backgroundColor-BgCoral sp-css-color-CoralFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"11-MPI"
]
},
"sp-css-backgroundColor-BgDustRose sp-css-color-DustRoseFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"14-MUSI"
]
},
"sp-css-backgroundColor-BgCyan sp-css-color-CyanFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"15-MPLI"
]
},
"sp-css-backgroundColor-BgPeach sp-css-color-PeachFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"18-MUCI"
]
},
"sp-css-backgroundColor-BgSage sp-css-color-SageFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"20-MICON"
]
},
"sp-css-backgroundColor-BgLightPurple sp-css-color-LightPurpleFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"21-MCI"
]
},
"sp-css-backgroundColor-BgViolet sp-css-color-VioletFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"22-AMI"
]
},
"sp-css-backgroundColor-BgLightBlue sp-css-color-LightBlueFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"24-MRSI"
]
},
"sp-css-backgroundColor-BgMauve sp-css-color-MauveFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"26-MTI"
]
},
"sp-css-backgroundColor-BgLilac sp-css-color-LilacFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"60-MTG"
]
},
"sp-css-backgroundColor-BgLightGray sp-css-color-LightGrayFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"61-JDH"
]
},
"sp-css-backgroundColor-BgBlue sp-css-color-WhiteFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"101-MTPL"
]
},
"sp-css-backgroundColor-BgGreen sp-css-color-WhiteFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"201-MTCI"
]
},
"sp-css-backgroundColor-BgBrown sp-css-color-WhiteFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"202-MCJV"
]
},
"sp-css-backgroundColor-BgDarkRed sp-css-color-WhiteFont",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$KCO]",
"AC"
]
},
"sp-css-backgroundColor-BgRed sp-css-color-WhiteFont",
"sp-field-borderAllRegular sp-field-borderAllSolid sp-css-borderColor-neutralSecondary"
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
},
"txtContent": "[$KCO]"
}
]
}
No RepliesBe the first to reply