Forum Discussion
TrevorC
10 months agoAdvocate I
Reference theme dataColors with DAX
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 tem...
- 10 months ago
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.
TrevorC
6 months agoAdvocate I
Hi there.
The folks at SQLBI.com have found a way to read some of the color codes.
Re-using visual formatting in and across Power BI reports - SQLBI
Combining the two approaches: referencing theme colors from DAX
Now, how do we use this with our themes? Well, it turns out that you can refer to theme colors from DAX. Like CSS color names, any top-level theme property that is a color can be used in a DAX expression. Examples include:
- Sentiment colors: “good”, “bad”, or “neutral”, which refer to positive, negative, and neutral sentiment theme colors, respectively.
- Diverging colors: “minColor”, “midColor”, or “maxColor”, which refer to min, middle, and max diverging theme colors, respectively.
- Container style colors: “foreground”, “background”, or “foregroundNeutralTertiary”, which refer to various elements as explained in the documentation for theme structural colors.
- Other structural colors: “tableAccent”, “null”, or “hyperlink”, which refer to the border of the table or matrix visual, empty colors in diverging conditional formatting, and the color of hyperlinks in tables and matrix visuals, respectively.