Forum Discussion
Anonymous
6 years agoNot applicable
Chart Colors: How to keep the initial theme colors on each chart
Hi, first time vistor here and a 2 week user of Power BI desktop. Background: I have a dataset from the UN FAO which lists crops grown by crop types in different countries. There are ove...
paul-maessen
Resolver I
6 years agoHi Mark,
You could have a look at the Color Utils that are available for Custom Visual Development: https://docs.microsoft.com/en-us/power-bi/developer/visuals/utils-color
To access the 8 defined colors in the Theme you can also use the getColor()-method from the IColorPalette-interface. You can get this colorPalette from your IVisualHost.
let colorPalette: IColorPalette = options.host.colorPalette; // host: IVisualHost
let color1 = colorPalette.getColor("0") // First Theme Color
let color2 = colorPalette.getColor("1") // Second Theme Color ...
I hope this will help you to get further with your visual.
Regards
Paul
Paul