Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello,
Does anyone know if it is possible to define the hexadecimal color of the categories of a data column in the theme json file?
Thanks.
Solved! Go to Solution.
Hi @Anonymous Power BI does not directly support defining hexadecimal colors for individual categories within a data column using the theme JSON file.But you can achieve the similar effect by creating measure.
example: as i have given to you with switch or if sttements you can follow:
FruitColor =
SWITCH (
TRUE (),
'Table'[Fruit] = "Peach", "#FFFFFF", // White for Peach
'Table'[Fruit] = "Strawberry", "#17563B", // Dark green for Strawberry
"#000000" // Default color (black)
)
you can replace table and column name as per your convinence.Set the data color property of the visual to use the FruitColor measure.
Hope this approach helps
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Proud to be a Super User! | |
Hi @Anonymous In your theme JSON file, define a custom color palette with the hexadecimal colors you want to use. For example:
{
"name": "Custom Theme",
"dataColors": ["#FF5733", "#33FF57", "#5733FF", "#CCCCCC"]
}
you can also use the customize theme options at view>> customize Current Theme option.
Hope it helps
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Proud to be a Super User! | |
Hello rajendraongole1, thanks for your reply, but I need to define the color by category value of a column.
For example, if I have the "Fruit" column, I would like to know if there is a way through the json file to indicate that I want "Peach" to be the hexadecimal code #FFFFFF, the "Strawberry" fruit to be #17563B, ...
Thanks.
Hi @Anonymous Power BI does not directly support defining hexadecimal colors for individual categories within a data column using the theme JSON file.But you can achieve the similar effect by creating measure.
example: as i have given to you with switch or if sttements you can follow:
FruitColor =
SWITCH (
TRUE (),
'Table'[Fruit] = "Peach", "#FFFFFF", // White for Peach
'Table'[Fruit] = "Strawberry", "#17563B", // Dark green for Strawberry
"#000000" // Default color (black)
)
you can replace table and column name as per your convinence.Set the data color property of the visual to use the FruitColor measure.
Hope this approach helps
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Proud to be a Super User! | |
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.