Fixing Color Contrast Issues

One of the more common compliance issues with ADA (Americans with Disabilities Act) is also one of the easiest to fix. Color contrast in relation to the text on the background requires that the text be easy to read by all users who access your website visually. Color contrast measures the difference between the font color and the background color on which the font is placed. The rule is quite simple:

  1. Text consisting of a font that is greater than 14 pt bold (19 px) or 18 pt normal (24 px) must have a 3:1 contrast ratio with the background on which the font is displayed.
  2. All other smaller text must have a contrast ratio of 4.5:1.

How do you calculate the color contrast between your font text and its background? You don’t need to know how to perform the calculation. There is a free tool that you can download and keep open on your desktop at all times so you can check the color contrast of everything you create. It was created by The Paciello Group and can be downloaded from this URL: The Paciello Group website – Colour Contrast Analyser.

But if the color contrast is not sufficient, how do you fix it. Well, of course, you try randomly selecting different colors, shades, hues, or tints of the original color until this tool calculates a satisfactory contrast ratio. For example, suppose the Colour Contrast Analyser was looking at a light blue (Hex: #1AB4E7) font on a white background (see image below). The initial colour contrast ratio is 2.4:1 which is too low even if the text was larger. You might think that the light blue on white looks good to you. However, you are not everybody and some people have more difficulty with colors than others. Thus, the Americans with Disabilities Act had to create a set of rules that were testable and verifiable to ensure a contrast that most people would find the resulting text to be easy to read against the background.

One way to ‘fix’ the problem is the click the dropdown arrow to the right of the box that displays the color which opens a grid of different colors as well as several different tints (adding white) to the base color and shades (adding black) to the base color. Because we want to increase the color contrast, we would perhaps try some of the shades. In the image below, the mouse is pointing to the second shade in the second (‘Shades’) row which has a hex value of #1487AE.

Colour Contrast Analyser dialog showing how you can test the contrast of other color combinations

However, even this shade of blue is not dark enough to contrast with the white background resulting in a value of 4.1:1. Good enough for larger text, but if the text is smaller, it still falls below the 4.5:1 requirement. We could go back to select the middle box (#0D5A74) which results in a great contrast of 7.7:1. However, it may be too dark. I am not going to go through the trial-and-error steps here of going back and forth between lighter tints and darker shades until you find one that just satisfies the 4.5:1 rule without deviating too much from your original color. Rather, I am going to introduce you to a second tool that can help you find a satisfactory color without all that trial and error.

The tool that I found is called the Tanaguru Contrast Finder. This tool, while free, is not something you need to download. Rather just go to the Tanaguru home page for the contrast finder.

Open the Tanaguru site to use the Contrast Finder tool

This tool’s home page lets start by specifying both the initial foreground (1) and background (2) colors. You can specify these colors either using the decimal values of the RBG color definition or you can enter the hex value of the color

Defining your foreground and background colors in the Tanaguru Contrast Finder

Next, you can select the minimum colour contrast ratio you must meet (3). If the text is smaller, select 4.5 as shown below. For larger text, select 3.1

Defining your contrast ratio goal and what you will allow the program to change to meet that goal

You can then select which color you want to change (4). In the case of regular text on the web page, you generally want to keep the page background color consistent across all of your pages. Therefore, I would change to the Edit the foreground color option.

You can also ask for colors that are very close to the initial color or a range of valid colors(4). I would in most cases go with a valid color very close to the initial color unless the contrast is too far from the ideal value in which case, I might ask for a range of valid colors to pick from.

When all the settings (1-4) are complete, click the Check and find contrast button (5). This is where the magic occurs.

After clicking the Check and find contrast button, the bottom half of the page is filled with possible colors that meet or exceed the color contrast you selected.

Output from the Tanaguru Contrast Finder of recommended colors to meet your contrast goal

First, it shows the original foreground and background colors to give you a reference. To the right, there is a sample of the text so you can see what it would look like on a web page followed by the calculated contrast ratio.

Beneath the original colors, you see the possible colors the algorithm has selected. Even if they all look a little similar to you, the actual RGB values displayed in the leftmost column show that these really are different shades of blue. Note that the ratio column shows a calculated ratio of 4.5 or greater for each of the color combinations.

What I find instructive in training your eye to spot questionable color contrast text is to focus on the sample text from about 4-5 feet away. No matter how good your vision may be, you will often see a significant difference between the original colors and the selected colors, especially in this case.

Another example is the following image fragment from a web page I ran across. The first thing that my eye picked up was the green text on the white background. Indeed, this combination is only 2.5:1. However, not as obvious to most web page editors is that the red used in this table also has a low contrast to the white background. While it is better than the green, it still is only 4.0:1 which is below the required color contrast ratio of 4.5:1.

Example of low contrast text colors on a white background.

In fact, this shade of red is often picked out of a grid of colors as shown in the font color grid within the editor. As shown below, a pure red that also has the RGB value of (255,0,0) may seem at first to be a good choice because it may appear to be a bright red on a white background. Note, however, that bright colors often have poor contrast on a white background but may work fine on a dark background. Keep this in mind: the color selection dialogs in almost all cases have no idea what the background color will be. Therefore, it displays a range of colors, some of which may work with your background color, and many that will not. It is your responsibility to determine if the resulting color contrast with the background color is acceptable.

Typical color grid for selecting a font color

In this case, the darker red to the left (#C00000 or RGB(192,0,0) actually provides a good contrast with white resulting in a contrast ratio of 6.5:1. Don’t even get me started on orange on white or even worse, yellow text on white

When you have text on a colored background such as the image shown below, the situation is much more complex because you can tweak both the font color and the background color to achieve the desired contrast ratio. (Yes, even text in images must meet the color contrast rules stated previously.) In this image, the yellow on the blue text has a ratio of only 2.1:1, the white font on a blue background is a ratio of only 2.4:1, the blue text on beige is only 2.2:1, and the red-orange on beige is a mere 1.6:1. I’m not even going to get into the effect on the crispness of the text when the image size is changed as was done here.

Colored text on different colored backgrounds

In a case like this, if you have access to the original graphic and can change the colors before you post the image, you must do that. Even if the image comes from a third party as is probably the case in this image, you cannot pass responsibility back to the third-party and use the image anyway. Either they must supply an image that satisfies ADA guidelines, or it cannot be used on your site.

Furthermore, this image contains substantial text that the vision impaired using a screen reader will not be able to ‘read’. Therefore, the text must either appear in the alt-text of the image or if there is too much text there (generally alt-text should be less than 160 characters), then the text should be elsewhere on the page or on a separate page linked from the ‘longdesc’ field of the image. In this case, to ensure ADA compliance, I would probably not use the image and just enter the text manually in a content portlet for the page.

In general, when looking at your page, you must consider people with all types of accessibility challenges such as:

  • Visitors with low color contrast vision.
  • Visitors who use screen readers to read the page contents.
  • Visitors who have low hearing ability should your page use sound or voice.
  • Visitors who cannot use a mouse to navigate around the page.
  • Visitors who are affected by flickering images from animated gifs.

Putting yourself ‘inside the heads’ of all of these different visitor types is a challenge, no doubt. However, it is what is required of an accessible web page.

One last point, all of the above applies not only to websites but to any content you make available to others within or outside of your organization because you just don’t know what challenges they may face.  It simply is the right thing to do.

By sharepointmike Posted in ADA

Tale of the alt, title and longdesc Attributes

Most of you probably know that the alt attribute found in the <img> tag is used by screen readers to assist the visually impaired and blind. What is alt text in the first place? It is the text that appears in place of the image if the user turns off graphics or if the user is using a screen reader as is the case for blind or visually impaired visitors to your site.

Is alt text always needed? Well the answer to that question begins with the question whether the image adds to the understanding of the other content on the page. As an example, look at this image found at the top of a page describing an art course:

Example of decorative image that should have a null string for the alt text

Or even the following image found in the page header of an elementary school.

Example of decorative image in a page header that should have al null string for the alt text

Do either of these images add any additional understanding of the art class page or the elementary school page? Would a user who turned off graphics or was blind or visually impaired and could not see these images really understand the rest of the page any less if they never knew the images existed? I would argue that they would not miss a thing. Therefore, these images are considered to be a decorative element on their respective pages and the alt attribute should be set to the null string as in the following: (not the word null)

alt=""

In addition, the title attribute should not be included for decorative images while it usually has the same text as the alt attribute. Strictly speaking, the title attribute is what the page visitor sees when they hover over the image with their mouse while the alt attribute is used by many search engines to catalog the image. So, having both of these attributes set to the same text is really not a bad thing.

Consider the following image with no text. How does it support the other content on the page?

Student races the car he built in the Engineering Magnet program.

In this case, you might have the alt text:

alt="Student races the car he built in the Engineering Magnet program."

Does it matter that the car is blue, the grass is green, they are on an athletic track, or that the student is wearing a helmet? Depending on the purpose of the story, the alt text shown above may be enough when combined with other content on the page.

On the other hand, suppose the image contains text as in the following image:

Example of image with simple text in it that says: Physical Education

While the image itself may not add to the understanding of the content on the page, the text must be included at a minimum in the alt attribute as in:

alt="Physical Education"

Note that the alt text must convey the same information as the text in the image. It is not necessary to say that it is the “Physical Education Banner” or “Physical Education Logo”. Adding words like “banner”, “logo”, “picture” or “image” is considered superfluous.

Some images have text that must be repeated in the alt attribute such as for the following image:

A blue T-shirt that says: We're all in this together

alt="A blue T-shirt that says: We're all in this together".

On the other hand, names on the sides of buildings, text in store windows, etc. if not pertinent to the content of the page do not have to be mentioned.

Sometimes the alt text can even be simplified. It is not always necessary to repeat the image text word for word as long as the meaning and intent are the same such as in the following image.

Image that says: Click image for information about distance learning for parents

alt="Click image for information about distance learning for parents"

Also, it is acceptable to convert the text to upper and lower case, define TLA (three-letter acronyms) as long as the converted text does not change the fundamental message of the image text.

What if the image and the text on the image do add substantially to the understanding of the page or even the purpose of the image. Then that information must be provided to the visually impaired in some way. If the image description is short or if the text is short, as we saw above, then the alt text can provide that additional information easily. But what if it is not short? While there is no physical limit on the length of alt text, it is recommended that alt text is kept short, 125 characters or less. Is that really enough to describe the image and the text on it? Take a look at the following image.

Image with more text than an alt attribute should have

Repeating all of this information in the alt attribute with only 125 characters or less would be impossible. This was the intended purpose of the longdesc attribute.

However, contrary to popular belief, the longdesc attribute is NOT a place for directly entering longer text, perhaps paragraphs or more in which to explain the image or the text on it. Rather, the longdesc defines a URL where the visitor can get more information about the image and/or the text on the image. While the status of the longdesc attribute is not entirely clear under HTML5, the main point is that it is not a duplicate of the alt attribute text nor is it a more detailed explanation of the image even though longdesc sounds like long description. It is a reference to a bookmark on the page or to the relative or absolute URL address of another page that describes the content and/or text in more detail.

In the above example, we might have the text of this information repeated elsewhere on the current page. If so, we can identify the content section by adding an id attribute inside any one of the following content tags that precede the content:

<p id="GraduationEventTimes">

<h3 id="GraduationEventTimes">

<div id="GraduationEventTimes">

(Note: Each id value can only appear once on a page. Otherwise, how would a link know which location to branch to. Make sense?)

Then in the longdesc attribute of the image, we would include the following:

longdesc="#GraduationEventTimes"

Note that the name assigned to the id attribute can contain only upper and lower case letters, no space, no numbers, and no special characters. When the id is referenced, it must begin with the ‘#’ sign to identify it as a bookmark name and not a page name.

It is also possible to reference another HTML page found at the same level as the page with the image. Suppose this page was given the name: “GraduationEventTimes.html” or “GraduationEventTimes.asp”. Then the longdesc attribute would be:

Longdesc="GraduationEventTimes.html"

Note the absence of the ‘#’ symbol, in this case, to identify the relative reference URL as another page on the same folder level as the current page.

You can also use relative URL references to traverse your folder structure, but that is a more advanced topic than what I wanted to cover here.

It is even possible to reference a page using an absolute reference that might exist on an entirely different site such as:

Longdesc="https://myschoolsite.edu/Seniors/GraduationEvents.hyml"

Relative and absolute references are actually the preferred way to handle charts and graphs in which the longdesc attribute points to a ‘hidden from menu’ page that describes the data used to create the charts and graphs and perhaps even includes the actual data tables used by them. Obviously, that much information would never fit within the limits of the alt attribute.

Anyway, I hope you learned something here about the alt, title, and longdesc attributes found in the <img> tag and to not use the longdesc attribute just to insert additional text describing the image or text in the image.

Monetary vs Fiscal Stimulus

Because I have an MBA (in addition to working in SQL Server and Power BI and because I am interested in the financial analysis side of things), a few people have asked me to explain the difference between Monetary and Fiscal stimulus when it comes to the way the federal government is fighting to keep our economy from falling into a depression at this time of the Coronavirus. So, let me give it my best shot.

Monetary stimulus is often associated by changes by the U.S. Federal Reserve to the interest rates charged to banks for loans. The theory being that as interest rates are lowered by the Federal Reserve, those banks in turn will make more money available to business, especially small business at lower rates. If this occurs as expected, it may help to keep small businesses which our country relies on from going out of business because they cannot otherwise pay their debts, their employees, and the cost of materials they need to conduct business. The Federal Reserve, I believe, can even now buy corporate debt to help those businesses survive.

Fiscal stimulus on the other hand consists of tax cuts, unemployment benefits, credits, government spending on infrastructure (which we could probably use) and even direct payments to individuals and families such as those checks many of you have recently received. This is money directly to individuals, not businesses. This is an entirely different tool than Monetary stimulus.

Still don’t see the difference? Think of it this way, Fiscal stimulus is the direct transfer of money from the federal government to the public through one or more different methods with no expectation of getting that money back. Yes, this increases our national debt and will someday in some way have to be repaid. If the economy soars, this can be done through normal fiscal methods without undo taxing of businesses and individuals would could hurt the economy. Only the spending on infrastructure has some ‘public’ return in the form of perhaps better roads, repaired bridges, and updated water and sewer lines. The rest of the fiscal stimulus is simply a hand out of money in the hope that people will pump it back into the economy to buy goods and services that they might not have bought before. If people just put it in their savings accounts, it will not help at all which is why most fiscal stimulus plans phase out as individual or family income rises.

On the other hand, Monetary stimulus does not simply hand out money. It is effectively money used for loans to business which the government expects to paid back at some time in the future. Even when the Federal Reserve buys corporate debt, they expect that debt to be paid back at some time in the future. Monetary stimulus also does not apply typically to individuals the way Fiscal stimulus does.

So, I hope that helps you understand a little about what is going on in the news these days. This will eventually all pass and we can get back into Power BI features and capabilities.

By sharepointmike Posted in Finance

Irresponsible Coronavirus Reporting?

All over the internet you see statistics about the Coronavirus. Yes, statistics are great to have, but without some basis, the numbers can be deceiving. For example, comparing the total number of cases or the total number of deaths by country and then ranking them that way is deceptive. Why? Because not every country has the same population! Duh! The real statistic that would be important to show is which country has been hit the worse, to compare the number of cases or deaths base on cases per 1000 people or any other consistent number. Of course, you may argue that we really don’t know the total number of cases or deaths because it is a given that the entire population of every country has not been tested and perhaps not all deaths have been reported as corona-related. Also, true. So, what does the statistic really tell us? Perhaps only that the coronavirus is something that needs to be addressed and that social distancing may have an effect in slowing it’s spread. It may even tell us within a country, a state, or even a county when the bell curve of new cases would indicate that the crisis is over. Of course, keep in mind that as more testing has occurred, the number of cases could grow, especially with milder cases that might not have been tested in the past because they did not have the symptoms to warrant testing. But should simple counts be used as a ranking tool? No!

I also why recovery counts are no longer typically shown. Total cases should be the sum of: Deaths + Recovery + Still Sick. To give us Total and death counts only is an incomplete picture of what is really going on.

A similar situation occurs here in the United States. Ranking states by the total number of cases or deaths is just as phony because not all states have the same population. It is entirely possible for a state with a total population smaller than another state may have a higher case or death rate. Does that make one state ‘safer’ than another and warrant earlier opening of that state? Should it be based on the state population? Again, cases per 1000 people to me is a much better way to determine your potential exposure to someone with the virus? Of course, even state number are somewhat deceptive as well as areas with greater population density are more ‘dangerous’ than areas that are sparsely populated.

I’m not going to repeat the above when it comes to comparing one county with another within a state, but you get the point by now right? Population density must be considered when determining how safe an area may be. If you are walking around in an area of low population density, you may see very few people while you are out, but if you work in one of the major metropolitan areas around the country, you might have close encounters of the contagious kind much more frequently.

As someone who is interest in Power BI, you know that statistics must be crafted carefully so as not to deceive or present an incorrect or distorted conclusion. That is something we all must be careful of when using Power BI to show statistics.

By sharepointmike Posted in Opinion

Working with Themes – Part 8

In Part 1 of this series, you learned how to use some of Power BI’s built-in.   

In Part 2 you learned about Microsoft’s Theme Gallery.    

In Part 3, you learned how to use the new Customize the Current Theme. 

In Part 4, you learned how to export your customized theme and to use it in your future Power BI report projects.   

In Part 5, you learned how to create a simple JSON theme file for your future Power BI report projects.  

In part 6, you learned about a few of the more common attributes used to customize the color of elements in the most commonly downloaded visualizations.

In part 7, you learned about a few more generic classes that define the colors for conditional formatting and KPIs.

By now you have seen several cases where the colors of some elements would change ‘magically’ when you apply a new theme to your reports. This is part of the artificial intelligence behind Power BI that looks at the color changes that have been applied by a theme and attempts to ‘adjust’ colors of other elements that have not been specified by the theme to something that should be compatible. If you remember, I touched on the fact that background colors appeared to change with some themes that defined only the dataColors array, but then was able to modify the background color by specifically using the background class. However, supplying a background class color also appeared to change the colors of other elements. I will not pretend to understand how that is done by Power BI so I am going to remind everyone of Arthur C. Clarke’s quote from “Profiles of the Future”: “Any sufficiently advanced technology is indistinguishable from magic.” However, if you can wrap your head around a hierarchy of color elements in which Power BI generates default values only if you do not define the color of those elements directly, you are on the right track to understanding how to control your theme colors.

That being said, as we dive further into the capabilities of JSON defined themes, we find additional ways to define those deeper elements which previously Power BI generated colors for when we did not specify them in our themes.

This week, I want to look at what Microsoft calls structural colors. Every visualization has some sort of structural element. These are typically elements outside of the typical data elements that are being displayed. They have been divided into first through fourth level elements. There is also a class for general background and for secondary background colors as well as Table Accent colors which is basically the grid outline.

Here is the problem, or challenge depending on how you look at it. How do you remember which structural elements appear in which of these 7 color classes? Honestly, I have not found an easy answer to this question other than to keep handy the table supplied by Microsoft (found in the How to Create a Theme link at the bottom of the ViewàThemes dropdown menu) and displayed below.

When you look at the table, notice that several class names have (deprecated) after the name. This does not mean that the entire class has been deprecated. Rather only an old name for the class has been deprecated. For example, the class name ‘foreground’ has been deprecated and is now known as ‘firstLevelElements’. Perhaps a comma between the new and old class names would have helped clarify that. Therefore, in my table below, I’ve added those commas. I’ve also added commas in the right column to help clarify what structural elements each color class formats.

As mentioned above, you should also note that we have seen three of these color classes before when we used the class names: background, foreground, and tableAccent. In fact, these three color classes appear in many of the themes that you can download from the Theme Gallery. They are used to provide compatible colors for many of the structure elements when using these themes. However, the class ‘foreground’ is being deprecated and should be replaced going forward with ‘firstLevelElements’. While both class names will work at the time of this writing, it is something that you should be aware of because someday the ‘foreground’ class will no longer be accepted when loading a theme. I am hoping that this will not affect older reports that previously applied themes with the deprecated class names. However, I have no secret insight on that question.

In the following table, you can see 7 color classes

Color class What it formats
firstLevelElements,

foreground (deprecated)

Labels background color (when outside data points),
Trend line color,
Textbox default color,
Table and matrix values and totals font colors,
Data bars axis color,
Card data labels,
Gauge callout value color,
KPI goal color,
KPI text color,
Slicer item color (when in focus mode),
Slicer dropdown item font color,
Slicer numeric input font color,
Slicer header font color,
Scatter chart ratio line color,
Line chart forecast line color,
Map leader line color,
Filter pane and card text color,
secondLevelElements,

foregroundNeutralSecondary (deprecated)

“light” secondary text classes,
Label colors,
Legend label color,
Axis label color,
Table and matrix header font color,
Gauge target and target leader line color,
KPI trend axis color,
Slicer slider color,
Slicer item font color,
Slicer outline color,
Line chart hover color,
Multi-row card title color,
Ribbon chart stroke color,
Shape map border color,
Button text font color,
Button icon line color,
Button outline color,
thirdLevelElements,

backgroundLight (deprecated)

Axis gridline color,
Table and matrix grid color,
Slicer header background color (when in focus mode),
Multi-row card outline color,
Shape fill color,
Gauge arc background color,
Applied filter card background color,
fourthLevelElements,

foregroundNeutralTertiary (deprecated)

legend dimmed color,
Card category label color,
Multi-row card category labels color,
Mulit-row card bar color,
Funnel chart conversion rate stroke color,
Background Labels background color (when inside data points),
Slicer dropdown items background color,
Donut chart stroke color,
Treemap stroke color,
Combo chart background color,
Button fill color,
Filter pane and available filter card background color,
secondaryBackground,

backgroundNeutral (deprecated)

Table and matrix grid outline color,
Shape map default color,
Ribbon chart ribbon fill color (when match series option is turned off),
tableAccent Overrides table and matrix grid outline color when present

So, suppose we created the following theme. Yes, this is still a theme even though we did not define values for the dataColors array element.

A Theme does not require the dataColors element

If you did not get what you wanted or expected when you applied this theme, maybe you need to combine everything we learned so far into a more complete theme definition such as:

A modify theme combining new formatting elements with dataColors

Anyway, I leave you to ‘play’ with what you have learned so far to see what new themes you can come up. In any case, we have not reached the bottom of this deep dive into themes yet. Stay tuned. Next time I will show you how to manipulate text families, colors, and sizes.

This Saturday, I will be speaking at SQL Saturday, Tampa on this theme, so to speak. If you are planning on attending, stop by my afternoon session or look for me to say, “Hi!”

Working with Themes – Part 7

In Part 1 of this series, you learned how to use some of Power BI’s built-in.

In Part 2 you learned about Microsoft’s Theme Gallery.

In Part 3, you learned how to use the new Customize the Current Theme.

In Part 4, you learned how to export your customized theme and to use it in your future Power BI report projects.

In Part 5, you learned how to create a simple JSON theme file for your future Power BI report projects

In part 6, you learned about a few of the more common attributes used to customize the color of elements in the most common visualizations

In this post, you will see a few more of the more attributes used for specific visualizations. The first four are used for conditional formatting but only when you format the values using a color scale. In the figure below, you see the default colors used for a color scale with a divergent value. Typically, the divergent value is centered on the middle value. More specifically, it is the average value between the minimum and maximum value, not a median value as you might at first think.

Conditional Formatting using a color scale

In my sample Contoso data, I used this conditional formatting to color the background of the Sales Amount for each country. Immediate you should notice that most of the values have a red background and only the United States has a green background. The only obvious color variation is for a few countries down the list including: China, Germany, France, and Japan. The rest look very close to the same color as the minimum color. The reason for this is that middle value is (1,951,503,966.95 + 4,693,341.12) / 2 or 979,598,654.04 is significantly larger than most of the values in the table. While China comes the closest to this value, it is still only 2/3 of the middle value. Therefore, even it has a color that is on the red side of yellow (the ‘center’ color) on the scale.

Color Scale does not show much color variation in a table with one extremely large value

One way to provide more color variation is to change how the divergent color is defined. Instead of using the middle value, click the dropdown to the right of ‘Middle value’ and select Custom. Then enter a value that you want to be the center. You could determine the median value. However, I’m just going to enter 50,000,000.00

Modify the center value to be custom rather than the middle value.

This change results is a significant improvement in the color gradients between the different country’s sales as shown in the next figure.

Conditional formatted column now shows more color variation

Using these default conditional colors could pose a problem for those who are red-green color blind in that they will not be able to easily determine by color alone which countries have the greatest sales. According to the Americans with Disabilities Act (ADA), this needs to be corrected. Now that you know how to build themes, you determine that you can set these colors using four new attributes (Remember, these only apply when the conditional formatting is defined with a color scale.):

Maximum: Defines the color of the maximum value.

Center: Defines the divergent color for either the Middle value or Custom value

Minimum: Defines the color of the minimum value.

Null: Defines the background color for any null value.

Suppose I defined a JSON file as follows.

JSON file to set the color for the Conditional Formatting Color Scale

When I apply this custom theme, my sales table conditional formatting changes to look like this:

Table showing the conditionally formatted colors from the JSON file

You might be interested to know that if you are using the new Customize Theme tool, these colors (except for NULL) correspond to the Divergent colors found on the Name and Colors page of the tool.

The conditional formatting colors are in the Divergent Colors section of the Customize Theme Tool.

Next, there is another set of colors that are used in waterfall charts and KPI visualizations. But what are these visualizations and why would you use them.

What is a waterfall chart? A Waterfall chart is a type of column chart that shows the change in a value from one period to the next. A line between two adjacent columns indicates the value of the measurement between the two time periods. If the right-side column rises, this is generally considered good. It the column falls, this is generally considered bad. Personally, you might want to use a waterfall chart to visually display the monthly fluctuation in your stock portfolio. The resulting waterfall chart can show the increases and decreases of your investment on a monthly basis over a year. The first column (leftmost) indicates the performance of your portfolio in the first time period (month). In the figure below, the initial investment of $50,000 fell $500 in the first month. The last column (rightmost) indicates the performance during the last period (month) which in the figure shows an increase of $2,470. The difference between the last column and the first column indicates the overall performance of the portfolio. In this figure, the difference between the start value of $50,000 and the ending value of $100,000 indicates a doubling of the investment in the year. Note that this chart displays the actual investment values. However, it is also possible to create a chart that works only with differences from the initial period and thus would start at zero.

Waterfall chart example showing monthly portfolio values

What is a KPI? KPI stands for Key Performance Indicator. They are used to measure a business factor and compare it to a goal rather than to just measure the change from the prior period such as in a waterfall chart. For example, if your company has a goal of growing sales 1% per month, you could then measure actual sales against this goal value to determine whether you are exceeding, meeting or falling behind that goal.

The colors used for these two different visualizations correspond to the following JSON attributes:

Good: Exceeding a KPI goal or an increase in the measured value during the current time period in a waterfall chart.

Neutral: Meeting a KPI goal or no change in the measured value during the current time period in a waterfall chart.

Bad: Falling behind a KPI goal or a decrease in the measured value during the current time period in a waterfall chart.

However, as in the case of the conditional formatting colors, the default colors use both red and green which could be a problem for those with red-green color blindness. These colors for KPIs and Waterfall charts can be found the Customize Theme tool in the Sentiment Colors area of the Name and Colors page.

Waterfall and KPI colors are in the Sentiment Colors of the Customize Theme tool

Therefore, you might want to change one or both colors as shown in the following JSON code:

JSON file to modify the Waterfall and KPI colors

After applying the theme, you can see that the Sentiment colors have been updated.

Sentiment colors in the Customize Theme Tool after applying the JSON file

I’ll leave it as an exercise for you to try this with your own data.

We still have a little more to examine as we dive even deeper into the JSON behind the themes.

C’ya next time.

Working with Themes – Part 6

In Part 1 of this series, you learned how to use some of Power BI’s built-in themes to change the color themes of your reports. This of course was better than having to manually customize all the elements in your visualizations, but you were limited in the number of themes available.

In Part 2 you learned about Microsoft’s Theme Gallery where 3rd party developers have offered their custom themes, mostly for free, to anyone who wanted to use them. Yes, you had to go through a few more steps, but this opened the doors to dozens of new themes that you could use to add different colors to your reports.

In Part 3, you learned how to use the new Customize the Current Theme feature that was added as a preview feature in December 2019. One of the great things about this feature is that it allows you to start from any theme and customize it to look exactly the way you want. But that is just part of the benefit of customizing a theme.

In Part 4, you learned how to export your customized theme and to use it in your future Power BI report projects. You discovered that you can create custom themes based on your organization’s colors/branding that you can share them within your department or the entire organization. You also learned how to resolve simple issues when your branding does not appear to work due to prior manual customizations to colors or fonts in your visualizations.

In Part 5, you learned how to create a simple JSON theme file for your future Power BI report projects. You saw how to define a set of colors that are used for many chart types and how they augment the default colors. You also learned that colors that you manually change in a visualization cannot be changed by a theme color until you revert those colors back to their defaults.

In part 5, we ended looking at a JSON theme file named CIVIC2.JSON repeated here for your convenience:

{

“name”: “Civic2”,

“dataColors”: [“#D16349”, “#CCB400”, “#8CADAE”, “#FF0000”,

“#8FB08C”, “#D19049”, “#D1A649”, “#81CC00”, “#8C9DAE”,

“#8C8870”, “#8CB09A”, “#CFD149”],

“background”: “#FFFFFF”,

“foreground”: “#8CADAE”,

“tableAccent”: “#D16349”

}

While we talked about the “dataColors” attribute, there were three other attributes that we did not discuss at the time. The first one “background”. This attribute is not what I first expected it to be. It is not the page background. I’ll talk about that a little later. Rather, this attribute is used to define the color for the following areas:

  • Labels background color (when inside data points)
  • Slicer dropdown items background color
  • Donut chart stroke color
  • Treemap stroke color
  • Combo chart background color
  • Button fill color
  • Filter pane and available filter card background color

While my goal here is not to show every place where this attribute is used, let me show you a page from one of my long-time SQL Saturday examples using the Contoso database. This is the way the report page looked originally showing a matrix table along with a Hierarchy Slicer and the relatively new style filter pane.

Original Filter pane and card colors

I then used the following theme which has the name “Blue BackGround”, but also goes by the file name: “Deep Blue.json”.

JSON file to focused on background color change

I’ve highlighted the line of code that represents the background color. Using my color picker, you can see that this is a light blue color

Color Picture shows the shade of blue base on RBG hext value

When I apply this theme to my Power BI report, the page now looks like the following image. You can see that the filter pane background now has the color of the background attribute.

Updated filter pane and card colors based on JSON file

But wait a minute, notice that the wallpaper which was previously a dark rust red is now a medium blue and the page background which was a turquoise is now a dark blue. What happened?

Well, originally the colors for both the wallpaper and the page background were manually set. I honestly did not expect that they would change. In fact, I went back and set the colors for both the wallpaper and page background to the default, which is white, and reapplied my custom theme. This time, they did not change and remained white. So why would these two attributes have changed color when they previously had a color that was manually set?

I must admit that this is puzzling and deserves more research. At this point, I am going to fall back on a theory that Power BI is somehow using some internal AI-like routines to define a wallpaper color based on other colors in the dataColors array when a theme is applied that does not specifically define page background or wallpaper color. Afterall, Microsoft does state that some secondary colors when not specifically set are calculated based on other colors in the theme. Specifically, the page background color appears to be related to the 8th color in this array. As I changed the 8th color to other colors different from the shade of blue (#000066), such as a shade of green (#006600), the page background displayed a variation of that new color. I am still looking for a correlation with the wallpaper color. If anyone has any insights on this, please let me know. In the meantime, I have an easier solution which I will share later in this post, so let’s move on.

According to Microsoft documentation, the next attribute, “foreground” is used to define the color for the following areas:

  • Labels background color (when outside data points)
  • Trend line color
  • Textbox default color
  • Table and matrix values and totals font colors
  • Data bars axis color
  • Card data labels
  • Gauge callout value color
  • KPI goal color
  • KPI text color
  • Slicer item color (when in focus mode)
  • Slicer dropdown item font color
  • Slicer numeric input font color
  • Slicer header font color
  • Scatter chart ratio line color
  • Line chart forecast line color
  • Map leader line color
  • Filter pane and card text color

In the prior theme definition, this attribute was set to #005C99 which results in a blue-green color. To get a better view of what this attribute changes, I set the color to fuchsia #FF0099 as shown below:

JSON file focused on Foreground Color change

After saving this theme and applying it to my report, it clearly affected the text in the filter panel. But it also effected the row and column header background colors in the matrix as well as one set of text colors in the matrix.

Changes to filter pane text as well as matrix table with foreground color set by JSON file

Finally, I took a look at the attribute tableAccent which Microsoft documentation says affects the following:

  • default coloring used by tables and matrix visualizations.
  • Overrides table and matrix grid outline color when present

JSON file focus on table Accent color change.

If you compare the following view of the page with the prior view, you can see that this appears to affect the alternating value lines in the matrix.

Changes to Matrix table due to JSON Accent color change

Because I was not happy with the automatic change to the page background color, I went into the Customize Current Theme option we examined in an earlier blog post in this series and manually set the page background colors of both the wallpaper and page background. I then exported the theme so I could look at the JSON file that was created. I highlighted the portion in code below that specifically defines the wallpaper color (#09A125) and page background (#AC0808). (Yes, deconstructing code is a time honored way to figure some things out.)

JSON code to change the page wallpaper color and page background color

When I applied this change to my report page, the page background is now set exactly as specified. While this code is a little more advanced, there is no reason why you could not use it to set the wallpaper and page background color for other report themes by simply changing the RGB color values. In a future blog post, I will go through the structure of this element to explain how code like this works. By the way, this is what the page would look like with this theme:

Result of changing the wallpaper and page background colors via the prior JSON file

One last point. The colors used here were never meant to be good or acceptable colors for a final report page. However, I wanted sufficient contrast in these colors so that you could see the effect of setting colors in each of the attributes we talked about. I hope that worked.

We have much more to examine as we dive deeper into the JSON behind the themes.

C’ya next time.

Working with Themes – Part 5

In Part 1 of this series, you learned how to use some of Power BI’s built-in themes to change the color themes of your reports. This of course was better than having to manually customize all the elements in your visualizations, but you were limited in the number of themes available.

In Part 2 you learned about Microsoft’s Theme Gallery where 3rd party developers have offered their custom themes, mostly for free, to anyone who wanted to use them. Yes, you had to go through a few more steps, but this opened the doors to dozens of new themes that you could use to add different colors to your reports.

In Part 3, you learned how to use the new Customize the Current Theme feature that was added as a preview feature in December 2019. One of the great things about this feature is that it allows you to start from any theme and customize it to look exactly the way you want. But that is just part of the benefit of customizing a theme.

In Part 4, you learned how to export your customized theme and to use it in your future Power BI report projects. You discovered that you can create custom themes based on your organization’s colors/branding that you can share them within your department or the entire organization. You also learned how to resolve simple issues when your branding does not appear to work due to prior manual customizations to colors or fonts in your visualizations.

So why do you need to know how to create your own themes from scratch using a simple text editor and JSON? Honestly, after seeing the new Customize the Current Theme feature back in December 2019, I wondered the same thing. I remember many times during my IT career where new languages, tools, or updates to existing products would simplify things that I would have previously spent hours doing directly in code. Many years ago, I came up with an answer to that question which for me said it all.

Use every tool available to you that can make your IT life simpler, but at the same time, understand as much as possible about how things work under the covers so that if you should need to customize something that the new fancy tool does not allow you to do, you can always dive into the code and directly do what is needed.

I remember my first editor from my FoxPro book days (actually it was for FoxPro 2.0, before Microsoft bought them) who said real programmers who buy computer books do not want to read a chapter about how to use form builders or report builders. They want to know how to code forms and reports directly. It took a while, but I eventually won my argument that making basic tasks like building forms and reports easier freed up more time for programmers to focus on more challenging customizations or additional features, or even writing documentation which they never want to do anyway. Besides, suggested that they use the builders as the first pass or foundation of what they needed and then dive back into the code to make the forms or reports do things that the programmers of those builders never imagined. I believe the same applies to this day.

Starting A JSON Theme File

First, what is a JSON file? Simply put, it is a collection of item-value pairs that can be created using any word processing software. Even something like Notepad or Notepad++ (my preference) provides all you need to get started. If you have ever worked with XML, you may already have insight into the way a JSON file looks and works. To illustrate that, let’s look at the JSON for one of the simpler themes I’ve downloaded for Power BI called Civic.

{

“name”: “Civic”,

“dataColors”: [“#D16349”, “#CCB400”, “#8CADAE”, “#8C7B70”,

“#8FB08C”, “#D19049”, “#D1A649”, “#81CC00”, “#8C9DAE”,

“#8C8870”, “#8CB09A”, “#CFD149”],

“background”:”#FFFFFF”,

“foreground”: “#8CADAE”,

“tableAccent”: “#D16349”

}

First, you can see that the JSON file is enclosed in curly braces. Within those braces are a series of “item”: “value” data pairs, five of them in this case each separated with a comma. All JSON files start with a name. In general, a JSON file is considered valid as long as it has a name. While the name value does not have to be the same as the filename itself, it will make your life a lot easier if they are the same. Of course, that would not be a very exciting theme because nothing would change if you applied it to a Power BI report file.

The second item-value pair is much more exciting because it defines the color palette of the new theme. In this case, the values are an array and must therefore appear within square brackets with each value separate from the others with a comma. The item “dataColors” defines the colors used by each data series in a line chart or each column series in a column chart or the wedge colors of a pie chart. It also updates the color palette that appears when you open the dropdown to format the color of an individual data item among other places.


Why Most Themes have 8 Colors and Should Yours?

You should note that a color palette is typically composed of a series of 10 colors with the first two always being white and black. In fact, by default, if you are creating a report visualization that has more than 8 data series, Power BI merely repeats the 8 colors using a slightly different tint or hue from the default palette to differentiate the colors. However, slightly changing the tint or hue of a color may not be obvious to everyone. Obviously, this can make charts very confusing. Perhaps this is the best reason why many report designers tell you that having more than 8 data series or 8 pie wedges should be avoided. Perhaps also for this reason, many themes have “dataColor” arrays with only eight distinct colors. If you remember from the Customize the Current Theme tool discussed Part 3, that dialog allows you to change/set only eight colors.

What if you really needed more than 8 distinct colors but use a template with only 8 unique colors? Well, in that case the first 8 colors will come from your theme, but the rest of the colors will be from the default palette again using different tints and hues just like before you applied your custom palette. Rather than mix themes, one solution to this problem would be to export your theme, edit the JSON file to add enough colors for all the data series or pie chart wedges, and then import the updated theme. For example, the Civic.json file shown above overwrites the first 12 colors and then revert back to the default palette if more colors are needed. But by editing the JSON file directly, you can ‘fix’ that shortcoming. That is what I meant about using tools for the foundation but knowing how to customize that foundation if necessary.

You can also define a color scheme that only changes a single color, perhaps because that color has a low contrast ratio with other colors in the report. For example, you could define a color palette with only a single color such as the following JSON file which changes the first palette color to red. What happens to the rest of colors? The original color palette is used for the next 7 colors and if colors must be repeated with different hues, the original first color in the palette is used, not the red color from the new theme.

{

“name”: “RedOne”,

“dataColors”: [“#aa0000”]

}

That’s great if you want to change only the first color, but what if you wanted to change the fourth color? Is there a way to skip the first 3 colors, perhaps by using a placeholder? Unfortunately, not that I’ve found. However, I could export the JSON for the theme I wanted, change only the fourth color to the one I want like red and upload the modified JSON file (now named Civic2.json) for the report. Again, we use the tool first, and then customize the code second. For example, the following code takes the Civic theme and changes the fourth color to red.

{

“name”: “Civic2”,

“dataColors”: [“#D16349”, “#CCB400”, “#8CADAE”, “#FF0000”,

“#8FB08C”, “#D19049”, “#D1A649”, “#81CC00”, “#8C9DAE”,

“#8C8870”, “#8CB09A”, “#CFD149”],

“background”: “#FFFFFF”,

“foreground”: “#8CADAE”,

“tableAccent”: “#D16349”

}

Revert to Default

Finally, I want to expand on something I talked about last time. The Revert to Default option only applies to manually set colors. It will not reset a data series or data point back to the default color theme if the colors were changed by using a theme. If fact, if you apply a color theme and then manually change the color of say the first color in the color pallet as defined by that theme, the Revert to Default option only reverts that color element to the last applied theme color, not the system default. On the other hand, one theme easily overwrites the colors from a prior color theme. So how can you remember this? It is a hierarchy. Think of CSS code.

  1. The Power BI color theme establishes the foundation set of colors.
  2. Applying a new theme only overwrites the default color theme or another color theme.
  3. Manual color changes overwrite default colors and colors from applied themes
  4. Revert to Default only removes a manual color change returning either the default color or the color of the last applied theme.

Of course, knowing how to change the colors in the dataColors array requires that you can get the RGB value of any color you want to use. While there are many tools that can do this, do you remember the Colour Contrast Analyzer I discussed in Part 2 and the Color Picker in Part 1.

I will continue from this point in my next post.

C’ya.

Working with Themes – Part 4

In Part 1 of this series, you learned how to use some of Power BI’s built-in themes to change the color themes of your reports. This of course was better than having to manually customize all the elements in your visualizations, but you were limited in the number of themes available.

In Part 2 you learned about Microsoft’s Theme Gallery where 3rd party developers have offered their custom themes, mostly for free, to anyone who wanted to use them. Yes, you had to go through a few more steps, but this opened the doors to dozens of new themes that you could use to add different colors to your reports.

In Part 3, you learned how to use the new Customize the Current Theme feature that was added as a preview feature in December 2019. One of the great things about this feature is that it allows you to start from any theme and customize it to look exactly the way you want. But that is just part of the benefit of customizing a theme.  The rest is what I’ll talk about today.

Exporting Your Customized Theme 

In the ancient past, as in a few months ago, if you wanted to theme all of your Power BI reports the same way, you not only had to manually set all of the color and text attributes for every visualization in a report, but you had to write down those settings so that on the next report you could configure the colors and text attributes the same way. While that was certainly doable, it was usually not worth the time and effort. A few users may have figured out enough of the JSON coding of themes to create their own custom theme and use it in each of the subsequent Power BI Report files. We will talk more about that method next time and why that might be your preferred option.

However, with the ‘Customize the Current Theme’ feature, you can start with an existing theme from the Theme Gallery that is close to what you want and customize it one time and then reuse it and even share it. That’s right. One time! Because with the addition of the Customize the Current Theme feature, you also have the ability to export the theme from your current Power BI file and save it as a JSON file.  You can then import this JSON file using the ‘Browse for themes’ option just like any other theme file you may have downloaded from the Theme Gallery we talked about in Part 2.   

Export your custom themes 

You just have to give your new theme a unique name (remember that was on the first panel of the Customize the Current Theme dialog). You can save the theme file anywhere, but I personally like to keep a single folder on my hard-drive that holds both my downloaded and my customized themes.

Making your Customized Theme a Standard 

Once you create a theme that is branded to your own personal tastes, your school or college colors, your corporate or organization’s color palette or for any other reason you need a special theme, you can save that theme definition as a file and share it with others. If everyone loads that theme into their report, then all report visualizations will look like they are all from the same person or part of one branded organization no matter who creates them.

One way to achieve consistency in branding is of course to share the exported theme to everyone so that they can import it into each Power BI file they create. However, this method could be problematic because some Power BI Users may not load that theme into their reports and proceed with either a different theme or with manually customized colors and fonts. Unfortunately, there is currently no way to change the default theme within Power BI. Maybe that feature will be a future enhancement.  In the meantime, one way to make compliance easier is to open a new but empty Power BI file, one in which no data has been loaded yet. Next, open View -> Themes and browse for and open a saved theme. Then save the empty Power BI file without adding any data to it. Then when you or anyone else begins a new Power BI file, start with this saved branded file to start a new report. For example, I save an empty Power BI file with my preferred theme using the name default.pbix. If I start a new report with this file, I will automatically have the same theme I used in my other Power BI files.

If you follow the suggestions above you can achieve a consistent look and feel across all of your Power BI reports. When used at a department, corporate, or organization level, it lends an air of professional branding to your work rather than the appearance that everyone if off working on their own.

What To Do When a Custom Theme Appears Not To Work 

Normally, when you apply one custom theme on top of another custom theme, the new theme replaces all the colors and fonts of the old theme (unless it is such an old theme or one that only defined a limited subset of the elements it would customize). Sometimes when you attempt to brand a previously created Power BI report, the branding colors or fonts do not appear to work, or perhaps they work on some visualizations but not on others.  Does this mean that there is something wrong with your branding? Probably not. It merely means that the default color or font used on one or more visualization was manually changed prior to applying the theme. Theme changes will not overwrite manually set branding. I suppose this is a good thing because the assumption is that you set those branding changes on purpose and you would not want to lose them due to applying a different custom theme to the rest of the report.

But what if you really wanted the branding of the custom theme to apply everywhere with no exceptions. Well, I suppose you could start over with the desired theme loaded first before loading data and creating visualizations. However, that would require a lot of work. Another way to fix this problem is to go into the formatting of each visualization and revert the branding to the default. Then reapply the desired custom theme.  That is still potentially a lot of work, but not as much as starting all over.

To revert the formatting of a visualization to the default, you do not have to remember the original colors, fonts, or font sizes. That would still be considered a manual customization.  Rather, you can select the visualization and open the Format panel. Expand each section within the Format panel and look for the text ‘Revert to default’ at the bottom of the section. Note that not all format sections may have or need this option.   

Revert any color or font to the default 

Even if you manually changed the color to other colors taken from the prior theme using the theme’s color palette, you will need to revert these colors and fonts to their original settings before a new theme will replace them.

Well that is all for this time. Next time, we will begin a dive into creating JSON files directly. Why would you want to do this?  Afterall, now with the ability to customize themes using a dialog, defining your own theme is simple and easy.  Well, you will have to come back next week to see if building a theme from scratch is right for you.

C’ya. 

Working with Themes – Part 3

In Part 1 of this series, you learned how to use some of Power BI’s built-in themes to change the color schemes of your reports.  This of course was better than having to manually customize all the elements in your visualizations, but you were limited in the number of themes available.   

In Part 2 you learned about Microsoft’s Theme Gallery where 3rd party developers have offered their custom themes, mostly for free, to anyone who wanted to use them.  Yes, you had to go through a few more steps, but this opened the doors to dozens of new themes that you could use to add different colors to your reports.   

Because these downloaded themes were written in a markup language called JSON, it was possible with a little effort to open these files and tweak the colors to those you wanted.  Maybe you did this by trial and error or maybe you found a few websites that tried to explain what the different elements in the JSON file meant. But at the same time, Microsoft was hard at working making it possible to customize more and more of the elements available in your reports.  How could you keep up with these changes? 

Activating a Preview Feature (After this feature goes live, you can skip this section) 

To solve the increasing complexity of building themes, Microsoft decided to add a new feature to help you customize your themes.  This feature was first released as a preview in the December 2019 update of Power BI Desktop.  Because it was a preview feature, you did not automatically see it in the toolbar.  To turn it on, you had to follow these steps: 

  1. After launching Power BI, click the File tab in the main menu.
  2. In the Backstage Menu, (or left side menu on most systems) look for: Options and Settings and click it.
  3. The right panel displays two menu items as shown below.  Click the first one, Options is what we want today.

     

  4. Selecting this action displays a dialog of available options, but because there are so many, they are divided up by categories which are displayed on the left side.  Look for and select the Preview features to see all the current features that are still in preview mode.  Then find the ones you want and select them by clicking the box to the left of the feature name.  Most of the preview features also have a ‘Learn more’ link that displays a page with additional information about that feature and how to use it.

     

  5. When you click Ok to close this dialog, you will probably be told that you have to close the current instance of Power BI and restart it in order to see the selected preview features.  So go ahead and do that.  I’ll be right here when you are ready to continue.

Customizing the Current Theme. 

After you have restarted Power BI, you can now open the View ribbon as you have done before to access the built-in themes and the Theme Gallery.  You should now see a new option at the bottom of the Theme dialog that says, Customize Current Theme. 

 

If you click this menu option, a new dialog opens with the title ‘Customize theme’ (shown below)  This dialog is a tabbed dialog with the tabs running down the left side.  When you click one of these tabs, the options available under that category of theme customizations appears in a second column.  For example, in the Name and Colors tab, you see two options, Name and Colors and an Advanced option.  Selecting either of these changes the options that appear in the right side of the dialog.   

 

Notice that you can supply a name for the custom theme here and define eight data colors.  Why eight?  Well I suppose they could have allowed any number, but considering that these colors are used for different data series in line, bar, and column charts as well as each slice of a pie chart, the general feeling is that having too many colors on any of these charts makes it hard to interpret as your eyes will have a difficult time determine slight variations in the shade of similar colors. 

There are also what are called Sentiment colors.  These colors are used in the key performance indicators and waterfall charts.  If your reports do not include these visualizations, you can probably ignore these colors.  

Next if you scroll down, you will see something called Divergent Colors.  These colors are used as default colors for conditional formatting of data to indicate three possible states, Minimum, Maximum and Neutral (or Middle).  Again, if you are not using conditional formatting, you can ignore these colors. 

Always be aware of the vertical scroll bar on the right side of this dialog as many of the pages contain more options than can be shown at one time.  Also look for and click on small circles with an ‘I’ inside of them as they typically provide a quick definition of features that may not be obvious. 

To change the colors in the current theme, click in the color box (on the dropdown arrow or even on the color itself).  This opens a color palette dialog like the one shown below.  While your eye may be drawn to the large square with various gradients of color, I would not start there.  Unless you are trying to match a specific color for which you know the RGB value, I would start with the ‘rainbow’ horizontal line of color hues.  You can click anywhere along with bar to select a basic color hue to start.  Next, I would look at the large square above and use it to blend in various amounts of white, black and grey to adjust the shade of the chosen color to the one you want. If you know the color’s RBG value, you can enter it directly in the box in the lower left.  Note that this requires the hexadecimal value of the color which uses two characters for first red, then green, and finally blue.  If instead you know only the decimal values for the amount of red, green, and blue, you will not have to find a decimal to hexadecimal converter.  Just enter the decimal values in the three box to the right of the hexadecimal box.  Note that decimal values in each of these boxes only range from 0 (#00) to 255 (#ff).  [Numbers displayed with a ‘#’ symbol at their start indicate the rest of the number is a hexadecimal number, not a decimal.  Therefore #85 is really 133 in decimal.] 

 

When you have the color you want to use, how do you save it?  There is no Save or Update button in the color palette dialog.  Simply click outside of the dialog and the change will be saved for that color element. Note that the color change will not take effect immediately.  In fact, it will only update the current theme colors of your Power BI report when you click the Apply and Save button in the Customize Theme dialog’s lower right.  This allows you to select other colors and change them and even go to other tabs in the customization dialog and change other features.  In fact, you can cancel your changes to the current theme at any time by clicking the Cancel button.  However, this dialog will update the current theme associated with the current Power BI reports as soon as you click the Apply and Save button. 

While we don’t have time today to go through all of the features you can customize using the Customize Current Theme tool, you can certainly try them on your own.  Just remember one thing.  Always save your starting Power BI reports so if you happen to accidentally create and apply a truly horrendous theme to your Power BI report, you can simply exit Power BI without saving your changes and then re-open the original report prior to your most recent theme customizations. 

Some of the other things that you can change other than colors within a theme include the font family for the text of different elements, the transparency of some elements, and you can turn on or off borders.  If you are thinking that there may still be some things missing that you would like to customize, but cannot, it could be simply that until this feature is out of preview, the Microsoft Power BI team could still be working on it to add more functionality, so be patient.  Even after it comes out of preview, if there are elements not included that you think should be, you can always provide that feedback to Microsoft using the ‘Submit an Idea’ button in the Help ribbon. 

So this time you learned how to customize the current theme for any Power BI report file and that customization is stored inside the report so if you pass the .pbix file to a co-worker who uses Power BI, they will see your custom colors, not the default ones.  Even if you publish your Power BI Desktop report to PowerBI.com, your custom colors will stay with the report.  Next time, I will talk a little more about what you can do with your customized theme and why you would do those things. 

C’ya next time.