Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
As a developer I want to be able to reference data colour hex codes via Dax. I can reference Divergent and Sentent colors but nothing else.
The reason I want to do this is to help me create templates that have page titles and use colors from the theme. What would be better would be to add three layers of color codes that can be used for branding of the reports.
Solved! Go to Solution.
Hi @TrevorC - Power BI doesn’t currently expose all theme color hex codes directly to DAX, which limits dynamic formatting and templating potential.
Good Idea, : you can post it in below link:
Fabric Ideas - Microsoft Fabric Community
Hope this helps.
Proud to be a Super User! | |
Hi @TrevorC,
As others have mentioned, not all colours are exposed currently.
Best practice at the moment would be to have a colour table that can be imported into your models and reference HEX/RGBA colours from there. It allows for use in conditional formatting, etc., and as long as your theme colours are constant, it is easy to match your theme.
Bonus points for creating an opposing text colour, taking into account contrast ratios.
| Have I solved your problem? Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;). |
Hi @TrevorC ,
At this time, Power BI does not provide direct access to all theme color hex codes (dataColors) within DAX. You may wish to submit this as a feature request or upvote an existing idea using the link provided.
Fabric Ideas - Microsoft Fabric Community
As a workaround, you can create a disconnected color table with category–color mappings and use a measure like below for conditional formatting:
Color Code =
LOOKUPVALUE(
ColorTable[ColorHex],
ColorTable[Category],
SELECTEDVALUE(Data[Category])
)
Then apply this measure in the Field value option under conditional formatting to get theme based colors.
Hi @TrevorC ,
I hope the information provided above assists you in resolving the issue. If you have any additional questions or concerns, please do not hesitate to contact us. We are here to support you and will be happy to help with any further assistance you may need.
Hi @TrevorC ,
I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you
Hi @TrevorC - Power BI doesn’t currently expose all theme color hex codes directly to DAX, which limits dynamic formatting and templating potential.
Good Idea, : you can post it in below link:
Fabric Ideas - Microsoft Fabric Community
Hope this helps.
Proud to be a Super User! | |
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 53 | |
| 42 | |
| 34 | |
| 33 | |
| 21 |
| User | Count |
|---|---|
| 143 | |
| 125 | |
| 100 | |
| 80 | |
| 59 |