How to turn your title into a color key

Sometimes you can make a chart a lot more simple & readable by integrating the color key directly into the title or description, like the one below:

In Datawrapper, this can be achieved with some simple HTML style commands. Note that we can style any text we want to do with this approach. The text we color doesn't need to be the variable name.

Scroll down to see an overview of style commands for your chart. What follows is a detailed explanation:

How styling your title & description works

Giving the text a color

For the chart above, this is our chart title without style commands:

Starting in 2019, the number of Germans older than 60 will surpass those younger than 30

To color the text like in the chart above, we write:

Starting in 2019, the number of <b style="color:#A08E00;">Germans older than 60</b> will surpass those <b style="color:#04607C;">younger than 30</b>

So how does it work? Writing <b> tells browsers that it should show the following text in bold, until it meets a </b>. Our entire title text is in bold already, so we don't see any bolder text. But try e.g. <i> for italic text, to see an effect.

We can now style this bold text between <b> and </b>. To do so, we give our bold text a style. And then we define the style – in our case, we give the text a color.

So text that's between <b style="color:#04607C;"> and </b> will be colored in a certain color. You can replace the color hex code #04607C with your own hex code or simple color names like "red".

Adding background color to the text

Sometimes, the colors in our charts are too bright to use them as text colors on a white chart background. Good thing that instead of giving our text a color, we can also fill the text background with a certain color. This will result in the following effect:

As you can see, instead of defining a color (which would be the text color), we now define a background. We will also define padding: This is just for aesthetic reasons, to give the background color some air to breathe. You can play around with the numbers yourself to see what you prefer.

For Africa, we define both, a text color and a background. That's because the background color is too dark to still use black as a text color. We define a white text color instead.

Underline color

When using more than two different colors, our chart title can quickly become too colorful & playful for the topic we might cover. Often, underlining the text with the variable color helps:

Note that colors are harder to distinguish the less area they cover: Orange and a lighter shade of orange are easier to distinguish when they fill the background of a whole word than just an underline. When using colored underlines, use colors that differ a lot in brightness or hue.

Instead of defining a text color or a background, we give everything between <b> and </b> a border-bottom. We can decide the thickness of this border (3px in our case), its style (solid, dashed, dotted or double) and its color.

After covering the three most important styles, here's an overview of them and some extra styles: