Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Todd88
New Member

Can you assign a color to a specific dimension's value in the theme JSON?

I am looking to assign specific colors to specific values in the JSON theme.  Is this possible?

 

For example, if the Company Name is "Facebook" use "#235eb5", if the Company Name is "Honda" use "#dd0f31", etc. (Hex codes not correct).

The only way I have found to do this is to go into each visualizations formatting and manually set the conditional formatting.  I would like the theme to detect the values and assign the colors.

1 ACCEPTED SOLUTION
Zanqueta
Super User
Super User

Hi @Todd88 ,

 

No, the Power BI theme JSON file does not currently support assigning colours to specific dimension values (e.g. "Facebook" = blue, "Honda" = red) automatically. Themes can define colour palettes and default formatting, but value-based conditional formatting must be configured manually or via rules inside visuals.

Current Options

1. Manual Conditional Formatting in Visuals

This is the method you're already using:
  • Go to the visual
  •  
  • FormatData coloursConditional formattingRules or field value.
  • Assign colours based on values (e.g. Company Name).

2. Using a Colour Mapping Table

You can create a table like:
Company Name Colour Hex
Facebook#235eb5
Honda#dd0f31

 

Then use this in conditional formatting by selecting Format by field value and pointing to the hex colour column.

 

zanqueta001_0-1762879732189.png

 

 

If this response resolved your issue, please mark it as correct to help other members of the community.

 

If this response was helpful in any way, I’d gladly accept a kudo.
Please mark it as the correct solution. It helps other community members find their way faster.
Connect with me on LinkedIn

View solution in original post

2 REPLIES 2
ajaybabuinturi
Resident Rockstar
Resident Rockstar

Hi @Todd88,

I would like to let you know that unfortunately Power BI themes (defined in a theme.json file) cannot dynamically assign colors to specific categorical values(Ex: Facebook, Honda and etc)

Power BI themes can only do global color palettes (data colors, backgrounds, text), specific visualization style default, global font sizes, gridlines, etc.

 

But there is a workaround, by using below meassure you can achieve you requirement. Then, in each visual use this measure for conditional formatting on the data color. You can reuse this measure across all visuals.

CompanyColor = 
SWITCH(
    SELECTEDVALUE('Company'[Company Name]),
    "Facebook", "#235eb5",
    "Honda", "#dd0f31",
    "Google", "#4285F4",
    "Apple", "#A2AAAD",
    "#808080"  // default color
)

 

Thanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.

 

Zanqueta
Super User
Super User

Hi @Todd88 ,

 

No, the Power BI theme JSON file does not currently support assigning colours to specific dimension values (e.g. "Facebook" = blue, "Honda" = red) automatically. Themes can define colour palettes and default formatting, but value-based conditional formatting must be configured manually or via rules inside visuals.

Current Options

1. Manual Conditional Formatting in Visuals

This is the method you're already using:
  • Go to the visual
  •  
  • FormatData coloursConditional formattingRules or field value.
  • Assign colours based on values (e.g. Company Name).

2. Using a Colour Mapping Table

You can create a table like:
Company Name Colour Hex
Facebook#235eb5
Honda#dd0f31

 

Then use this in conditional formatting by selecting Format by field value and pointing to the hex colour column.

 

zanqueta001_0-1762879732189.png

 

 

If this response resolved your issue, please mark it as correct to help other members of the community.

 

If this response was helpful in any way, I’d gladly accept a kudo.
Please mark it as the correct solution. It helps other community members find their way faster.
Connect with me on LinkedIn

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.