[go: up one dir, main page]

Paul Tol's Notes

Colour schemes and templates

INTRODUCTION TO COLOUR SCHEMES

18 August 2021

Graphics with scientific data become clearer when the colours are chosen carefully. It is convenient to have good default schemes ready for each type of data, with colours that are:

  • distinct for all people, including colour-blind readers;
  • distinct from black and white;
  • distinct on screen and paper;
  • matching well together.
This site shows such schemes, developed with the help of mathematical descriptions of colour differences and the two main types of colour-blind vision. A colour scheme should reflect the type of data shown. There are three basic types of data:
  • Qualitative data – nominal or categorical data, where magnitude differences are not relevant. This includes lines in plots and text in presentations.
  • Diverging data – data ordered between two extremes where the midpoint is important, e.g. positive and negative deviations from zero or a mean.
  • Sequential data – data ordered from low to high.
The following three sections describe colour schemes for these types of data. Other topics:
  • Info on simulating approximately how any colour is seen if you are colour-blind.
  • The schemes that work well in a monochrome display or printout are highlighted, with tips on how to use them best.
  • A very specific colour scheme for the AVHRR global land cover classification.
  • A look at a traditional, bad rainbow scheme and how a scheme with fewer colours can be better.
  • A way of splitting the data analysis and the production of maps.
  • SRON specific: templates for PowerPoint and LaTeX.
Global CO column mixing ratio on 26 June 2023 (frame from movie of TROPOMI data)
The smooth rainbow sequential colour scheme is used for example in my test movies of atmospheric CO and methane as measured by TROPOMI since 2017, collected on a separate page.


QUALITATIVE COLOUR SCHEMES

2 April 2021

My default colour scheme for qualitative data is the bright scheme in Fig. 1. Colour coordinates (R,G,B) are given in the RGB colour system (red R, green G and blue B), decimal at the top and hexadecimal below. Click on this and other defining figures for the hexadecimal values as text. An alternative when fewer colours are enough is the high-contrast scheme in Fig. 2, which also works when converted to greyscale. A second alternative is the vibrant scheme in Fig. 3, designed for data visualization framework TensorBoard. A third alternative is the muted scheme in Fig. 4, which has more colours, but lacks a clear red or medium blue. A fourth alternative is the medium-contrast scheme in Fig. 5 with three colour pairs that can work in greyscale, but not as well as the high-contrast scheme. If more than nine colours are really needed, a sequential colour scheme can be (mis)used: the discrete rainbow colour scheme (Fig. 21), skipping the lightest colours for lines on a white background, or the smooth rainbow colour scheme (Fig. 20) starting at purple, interpolated in large equal steps.

Bright scheme

Colours in default order: '#4477AA', '#EE6677', '#228833', '#CCBB44', '#66CCEE', '#AA3377', '#BBBBBB'.

Figure 1: Bright qualitative colour scheme that is colour-blind safe. The main scheme for lines and their labels.
High-contrast scheme

Colours in default order: '#004488', '#DDAA33', '#BB5566'.

Figure 2: High-contrast qualitative colour scheme, an alternative to the bright scheme of Fig. 1 that is colour-blind safe and optimized for contrast. The samples underneath are shades of grey with the same luminance; this scheme also works well for people with monochrome vision and in a monochrome printout.
Vibrant scheme

Colours in default order: '#EE7733', '#0077BB', '#33BBEE', '#EE3377', '#CC3311', '#009988', '#BBBBBB'.

Figure 3: Vibrant qualitative colour scheme, an alternative to the bright scheme of Fig. 1 that is equally colour-blind safe. It has been designed for data visualization framework TensorBoard, built around their signature orange FF7043. That colour has been replaced here to make it print-friendly.
Muted scheme

Colours in default order: '#CC6677', '#332288', '#DDCC77', '#117733', '#88CCEE', '#882255', '#44AA99', '#999933', '#AA4499'. Bad data: '#DDDDDD'.

Figure 4: Muted qualitative colour scheme, an alternative to the bright scheme of Fig. 1 that is equally colour-blind safe with more colours, but lacking a clear red or medium blue. Pale grey is meant for bad data in maps.
Medium-contrast scheme Medium-contrast scheme application

Colours in default order: '#6699CC', '#004488', '#EECC66', '#994455', '#997700', '#EE99AA'.

Figure 5: Medium-contrast qualitative colour scheme, an alternative to the high-contrast scheme of Fig. 2 that is colour-blind safe with more colours. It is also optimized for contrast to work in a monochrome printout, but the differences are inevitably smaller. It is designed for situations needing colour pairs, shown by the three rectangles, with the lower half in the greyscale equivalent.

The bright, high-contrast, vibrant, muted and medium-contrast schemes work well for plot lines and map regions, but the colours are too strong to use for backgrounds to mark (black) text, typically in a table. For that purpose, the pale scheme is designed (Fig. 6, top). The colours are inherently not very distinct from each other, but they are clear in a white area. The dark scheme (Fig. 6, bottom) is meant for text itself on a white background, for example to mark a large block of text. The idea is to use one dark colour for support, not all combined and not for just one word.

Pale scheme

Colours: '#BBCCEE', '#CCEEFF', '#CCDDAA', '#EEEEBB', '#FFCCCC', '#DDDDDD'.

Dark scheme

Colours: '#222255', '#225555', '#225522', '#666633', '#663333', '#555555'.

Figure 6: Pale and dark qualitative colour schemes where the colours are not very distinct in either normal or colour-blind vision; they are not meant for lines or maps, but for marking text. Use the pale colours for the background of black text, for example to highlight cells in a table. One of the dark colours can be chosen for text itself on a white background, for example when a large block of text has to be marked. In both cases, the text remains easily readable (see Fig. 10).

There are situations where a scheme is needed between the bright and pale schemes, for example (Fig. 10) for backgrounds in a table where more colours are needed than available in the pale scheme and where the coloured areas are small. For this purpose, the light scheme of Fig. 7 is designed.

Light scheme

Colours in default order: '#77AADD', '#EE8866', '#EEDD88', '#FFAABB', '#99DDFF', '#44BB99', '#BBCC33', '#AAAA00', '#DDDDDD'.

Figure 7: Light qualitative colour scheme that is reasonably distinct in both normal and colour-blind vision. It was designed to fill labelled cells with more and lighter colours than contained in the bright scheme of Fig. 1, using more distinct colours than that in the pale scheme of Fig. 6 (top), but keeping black labels clearly readable (see Fig. 10). However, it can also be used for general qualitative maps.

Colour names have been added to the scheme definitions as mnemonics for the maker of a figure, not necessarily for use in text: a reader should not have to guess what olive looks like. Colours are identified uniquely by their names within the collective of the bright, pale, dark and light schemes, whereas the high-contrast, vibrant, muted and medium-contrast schemes reuse some names for different colours.

The colours within a qualitative scheme are given in order of changing hue (or luminance in the case of the high- and medium-contrast schemes), but the colours can be picked at random. Often, a data type suggests an appropriate choice or similar data types can be grouped by giving them similar colours. If the colours have to be picked in a fixed sequence, a good order for each scheme is as follows. Click on the defining figures above for the hexadecimal values in this order as text.

bright:
 blue  red  green  yellow  cyan  purple  grey 
high-contrast:
 blue  yellow  red 
vibrant:
 orange  blue  cyan  magenta  red  teal  grey 
muted:
 rose  indigo  sand  green  cyan  wine  teal  olive  purple 
medium-contrast:
 light blue  dark blue  light yellow  dark red  dark yellow  light red 
light:
 light blue  orange  light yellow  pink  light cyan  mint  pear  olive  pale grey 

Examples of the use of the qualitative schemes are given in Figs. 8 and 9 for lines of the Tokyo metro and in Fig. 10 for cell backgrounds and text blocks.

Bright
Tokyo metro in bright scheme
High-contrast
Tokyo metro in high-contrast scheme
Vibrant
Tokyo metro in vibrant scheme
Muted
Tokyo metro in muted scheme
Medium-contrast
Tokyo metro in medium-contrast scheme
Figure 8: Metro lines in Tokyo coloured using the bright, high-contrast, vibrant, muted and medium-contrast scheme.
Light
Tokyo metro in light scheme
Figure 9: Metro lines in Tokyo coloured using the light scheme, showing that the light scheme is not meant for lines on a white background (see Fig. 10).
Pale
Cell backgrounds in pale scheme
Light
Cell backgrounds in light scheme
Figure 10: Examples of filling labelled cells. The pale colour scheme can be used for most cases: large patterns with few colours. The highlighting works while the text remains easily readable. The light colour scheme is better when more colours are needed or the colours need to be more distinct, for example when the areas with one colour are small. Note that if the colours were darker, the small print would become difficult to read, while this scheme is much lighter than the schemes for lines (see Fig. 9). This caption is set in dark green, which is distinct from black but still easily readable.
The application to maps is shown in Fig. 11. It is a stylized variation of the diagnostic map used by the ColorBrewer website. In one area, all colours are shown in a random pattern. In other areas, basically one colour is shown, but with one small area of each other colour included. This indicates how well the colours within a scheme are identifiable when all of them are used.
Diagnostic map in bright scheme Diagnostic map in high-contrast scheme Diagnostic map in vibrant scheme Diagnostic map in muted scheme Diagnostic map in medium-contrast scheme Diagnostic map in light scheme
Figure 11: From top to bottom, diagnostic maps for the bright, high-contrast, vibrant, muted, medium-contrast and light qualitative schemes, given in Figs. 1, 2, 3, 4, 5 and 7, respectively. For each scheme, the section at the left contains all colours, while each of the other sections contains one colour with one diamond of each other colour. This tests how well the colours are identifiable.

The design of the qualitative schemes involved four types of calculations:

  • for the distance between colours the CIEDE2000 colour difference ΔE00 is used;
  • red-blind and green-blind vision is simulated by the method described later;
  • colours with the same product of saturation S and value V in the HSV colour system (same vividness) match well together;
  • colours are called print-friendly if they are within the CMYK gamut provided by colour profile ISO Coated v2 300 % (discussed below).
To reduce the number of calculations without much loss of choice, only websmart colours were considered, meaning the hexadecimal RGB coordinates are only 00, 11, ..., FF.

All colours on this site are defined in sRGB colour space, the default used by most software and displays. Printers work in a different colour space that also varies from model to model. When they conform to international standard ISO 12647-2 and the exact printing conditions are not known beforehand, it is recommended to assume the CMYK colour space provided by colour profile ISO Coated v2 300 %. All scheme colours are taken from the overlap between this and the sRGB colour spaces. Individual printers may deviate, probably not so much that colours become unrecognizable, but enough to push some colours closer together. However, it is not possible to take individual printers into account.

The Netherlands Standardization Institute NEN has issued a code of practice which includes a recommended scheme with eight colours, three greys and white. The colours are bright, but differences between them in colour-blind vision are often much smaller than the smallest difference in the bright, vibrant or muted schemes, two colours are not print-friendly and they cannot be quoted without infringing copyright.


DIVERGING COLOUR SCHEMES

9 October 2022

Diverging schemes are for ordered data between two extremes where the midpoint is important. Such schemes could be constructed simply by scaling the colour coordinates linearly, e.g. from blue to white to red. However, by including subtle hue changes, the colours are more distinct and the schemes more attractive. Figures 12, 12a, 13 and 14 show the sunset, nightfall, BuRd and PRGn schemes, which are tweaked versions of schemes on the ColorBrewer website. The darkest shades of the original versions have been removed, because they are too dark and similar to be used in practice. The circled colour is meant for bad data, without drawing attention away from good data with a large deviation from zero. The sunset and nightfall schemes were designed for situations where bad data have to be shown white, with more hues in the nightfall scheme. The four schemes look similar in colour-blind vision, so if more than one is used, do not reverse the direction in one of them. If more colours than shown are needed from a given scheme, use a continuous version of the scheme instead of the discrete colours, by linearly interpolating the colour coordinates. If fewer colours are needed, pick colours at equidistant points in the continuous version.

Sunset scheme

Colours: '#364B9A', '#4A7BB7', '#6EA6CD', '#98CAE1', '#C2E4EF', '#EAECCC', '#FEDA8B', '#FDB366', '#F67E4B', '#DD3D2D', '#A50026'. Bad data: '#FFFFFF'.

Figure 12: Sunset diverging colour scheme that also works in colour-blind vision. The colours can be used as given or linearly interpolated. The circled colour is meant for bad data. The scheme is related to the ColorBrewer RdYlBu scheme, but with darker central colours and made more symmetric.
Nightfall scheme

Colours: '#125A56', '#00767B', '#238F9D', '#42A7C6', '#60BCE9', '#9DCCEF', '#C6DBED', '#DEE6E7', '#ECEADA', '#F0E6B2', '#F9D576', '#FFB954', '#FD9A44', '#F57634', '#E94C1F', '#D11807', '#A01813'. Bad data: '#FFFFFF'.

Figure 12a: Nightfall diverging colour scheme that also works in colour-blind vision. The colours are linearly interpolated or every second colour is skipped when used as given. The circled colour is meant for bad data. The scheme is inspired by the ColorBrewer PuBuGn and YlOrRd schemes.
BuRd scheme

Colours: '#2166AC', '#4393C3', '#92C5DE', '#D1E5F0', '#F7F7F7', '#FDDBC7', '#F4A582', '#D6604D', '#B2182B'. Bad data: '#FFEE99'.

Figure 13: BuRd diverging colour scheme that also works in colour-blind vision. The colours can be used as given or linearly interpolated. The circled colour is meant for bad data. This is the reversed ColorBrewer RdBu scheme.
PRGn scheme

Colours: '#762A83', '#9970AB', '#C2A5CF', '#E7D4E8', '#F7F7F7', '#D9F0D3', '#ACD39E', '#5AAE61', '#1B7837'. Bad data: '#FFEE99'.

Figure 14: PRGn diverging colour scheme that also works in colour-blind vision. The colours can be used as given or linearly interpolated. The circled colour is meant for bad data. This is the ColorBrewer PRGn scheme, with green A6DBA0 shifted to ACD39E to make it print-friendly.
Examples of the use of the diverging schemes for maps are given in Figs. 15 and 16.
Discrete sunset
Map in discrete sunset scheme
Discrete nightfall
Map in discrete nightfall scheme
Discrete BuRd
Map in discrete BuRd scheme
Discrete PRGn
Map in discrete PRGn scheme
Smooth sunset
Map in smooth sunset scheme
Smooth nightfall
Map in smooth nightfall scheme
Smooth BuRd
Map in smooth BuRd scheme
Smooth PRGn
Map in smooth PRGn scheme
Figure 15: Examples of maps using the diverging colour schemes of Figs. 12, Figs. 12a, 13 and 14, each discrete and interpolated.
Diagnostic map in sunset scheme Diagnostic map in nightfall scheme Diagnostic map in BuRd scheme Diagnostic map in PRGn scheme
Figure 16: Diagnostic maps for the four diverging schemes given in Figs. 12, Figs. 12a, 13 and 14. For each scheme, the section at the left contains all colours, while each of the other sections contains one colour with one diamond of each other colour. This tests how well the colours are identifiable when kept discrete.


SEQUENTIAL COLOUR SCHEMES

8 May 2022

Sequential schemes are for ordered data from low to high. The YlOrBr scheme given in Fig. 17 is a tweaked version of the ColorBrewer YlOrBr scheme. The most distinct grey is also given, useful for data gaps; it is not meant for extreme values. If more colours than shown are needed from this scheme, use a continuous version of the scheme instead of the discrete colours, by linearly interpolating the colour coordinates. If fewer colours are needed, pick colours at equidistant points in the continuous version. An alternative continuous scale is provided by the iridescent scheme, which is the linear interpolation of the colours specified in Fig. 18. The luminance varies linearly, so this scheme also works well for people with monochrome vision and in a monochrome printout. The incandescent scheme in Fig. 18a also has a linearly varying luminance, useful on screen: it has brighter colours, but is not print-friendly, i.e. the colours may shift on paper.

YlOrBr scheme

Colours: '#FFFFE5', '#FFF7BC', '#FEE391', '#FEC44F', '#FB9A29', '#EC7014', '#CC4C02', '#993404', '#662506'. Bad data: '#888888'.

Figure 17: YlOrBr sequential colour scheme that also works in colour-blind vision. The colours can be used as given or linearly interpolated. The grey is meant for bad data. This is the ColorBrewer YlOrBr scheme, with orange FE9929 shifted to FB9A29 to make it print-friendly. Pale yellow FFFFE5 can be set to completely white FFFFFF, for example in density histograms.
Iridescent scheme

Colours: '#FEFBE9', '#FCF7D5', '#F5F3C1', '#EAF0B5', '#DDECBF', '#D0E7CA', '#C2E3D2', '#B5DDD8', '#A8D8DC', '#9BD2E1', '#8DCBE4', '#81C4E7', '#7BBCE7', '#7EB2E4', '#88A5DD', '#9398D2', '#9B8AC4', '#9D7DB2', '#9A709E', '#906388', '#805770', '#684957', '#46353A'. Bad data: '#999999'.

Figure 18: Iridescent sequential colour scheme with a linearly varying luminance that also works in colour-blind vision. The colours should be linearly interpolated, optionally extended towards white and black. The grey is meant for bad data.

Incandescent scheme

Colours: '#CEFFFF', '#C6F7D6', '#A2F49B', '#BBE453', '#D5CE04', '#E7B503', '#F19903', '#F6790B', '#F94902', '#E40515', '#A80003'. Bad data: '#888888'.

Figure 18a: Incandescent sequential colour scheme with a linearly varying luminance that also works in colour-blind vision, but it is not print-friendly. The colours should be linearly interpolated, optionally extended towards white and black. The grey is meant for bad data. Take into account that pale cyan CEFFFF is almost white in red-blind vision.

There are many warnings that ordered data should not be shown with a rainbow scheme. The arguments are:

  • The spectral order of visible light carries no inherent magnitude message. However, a rainbow provides a scheme with many colours, showing subtle effects in the data clearer or making it easier to read the value in a map. There are also cases where a scheme is preferred that does not have pale colours at the low end or middle of the range.
  • Most rainbow schemes contain bands of almost constant hue with sharp transitions between them, which are perceived as jumps in the data. This can be avoided with careful design.
  • Colour-blind people have difficulty distinguishing some colours of the rainbow. This can be taken into account in the design.
Here are given a discrete rainbow scheme (Fig. 19) and a smooth rainbow scheme (Fig. 20) that are reasonably clear in colour-blind vision. To remain colour-blind safe, the discrete rainbow scheme should not be interpolated. The smooth rainbow scheme does not have to be used over the full range (see caption of Fig. 20).
Discrete rainbow scheme with 14 coloursDiscrete rainbow scheme with 23 colours

All colours: '#E8ECFB', '#D9CCE3', '#D1BBD7', '#CAACCB', '#BA8DB4', '#AE76A3', '#AA6F9E', '#994F88', '#882E72', '#1965B0', '#437DBF', '#5289C7', '#6195CF', '#7BAFDE', '#4EB265', '#90C987', '#CAE0AB', '#F7F056', '#F7CB45', '#F6C141', '#F4A736', '#F1932D', '#EE8026', '#E8601C', '#E65518', '#DC050C', '#A5170E', '#72190E', '#42150A'. Bad data when 23 colours are used: '#777777'.

Figure 19: Discrete rainbow colour scheme with 14 or 23 colours for maps. See Fig. 21 for the best subset if a different number of colours is needed. The colours have to be used as given: do not interpolate. For a smooth rainbow scheme, see Fig. 20. The grey is meant for bad data, but white can also be used, except in the case of exactly 23 colours. The colours have been numbered for easy referencing in Fig. 21.
Smooth rainbow scheme

Colours: '#E8ECFB', '#DDD8EF', '#D1C1E1', '#C3A8D1', '#B58FC2', '#A778B4', '#9B62A7', '#8C4E99', '#6F4C9B', '#6059A9', '#5568B8', '#4E79C5', '#4D8AC6', '#4E96BC', '#549EB3', '#59A5A9', '#60AB9E', '#69B190', '#77B77D', '#8CBC68', '#A6BE54', '#BEBC48', '#D1B541', '#DDAA3C', '#E49C39', '#E78C35', '#E67932', '#E4632D', '#DF4828', '#DA2222', '#B8221E', '#95211B', '#721E17', '#521A13'. Bad data when off-white is used: '#666666'.

Figure 20: Smooth rainbow colour scheme. The colours are meant to be linearly interpolated: for a discrete rainbow scheme, see Fig. 19. Often it is better to use only a limited range of these colours. Starting at purple, bad data can be shown white, whereas starting at off-white, the most distinct grey is given in the circle. If the lowest data value occurs often, start at off-white instead of purple. If the highest data value occurs often, end at red instead of brown. For colour-blind people, the light purples and light blues should not be mixed much.
Examples of the use of all sequential schemes for maps are given in Figs. 22 and 23.

The discrete rainbow colour scheme is inspired by the temperature map of the weather forecast in newspaper de Volkskrant: unconnected curves in CIELAB colour space for purples, blues, greens and oranges, each sampled three times but the last one twice extra for yellow and red, in total 14 colours. The curves were straightened, shifted and sampled equidistantly to make the colours more distinct, reasonably colour-blind safe and print-friendly. Later, the lines were resampled with smaller distances and the scheme was extended towards white and black, to get 23 colours. Figure 21 shows how the two sets can be combined to make a scheme with any number of colours up to 23.

If you have an application where one of the colours stands out too much (for example colour 18), use a set with one extra colour and skip the unwanted colour. A discrete scheme with even gentler steps can be constructed by interpolating the smooth rainbow colour scheme above in large equal steps. However, these two alternatives make it harder to identify which colour is used in a given map area.

Discrete rainbow scheme with any number of colours up to 23
Figure 21: Discrete rainbow colour scheme for maps, with 1 to 23 colours. The numbers refer to the colour definitions in Fig. 19.
Discrete YlOrBr
Map in discrete YlOrBr scheme
Discrete rainbow (14 colours)
Map in discrete rainbow scheme with 14 colours
Smooth rainbow (purple to red)
Map in smooth rainbow scheme from purple to red
Smooth rainbow (purple to brown)
Map in smooth rainbow scheme from purple to brown
Smooth YlOrBr
Map in smooth YlOrBr scheme
Discrete rainbow (23 colours)
Map in discrete rainbow scheme with 23 colours
Smooth rainbow (off-white to red)
Map in smooth rainbow scheme from off-white to red
Smooth rainbow (off-white to brown)
Map in smooth rainbow scheme from off-white to brown
Iridescent
Map in iridescent scheme
Incandescent
Map in incandescent scheme
Figure 22: Examples of maps using the sequential colour schemes given in Figs. 17, 18, 18a, 19 and 20.
Diagnostic map in YlOrBr scheme Diagnostic map in discrete rainbow scheme with 14 colours Diagnostic map in discrete rainbow scheme with 23 colours
Figure 23: Diagnostic maps for the discrete sequential schemes given in Figs. 17 and 19. For each scheme, the section at the left contains all colours, while each of the other sections contains one colour with one diamond of each other colour. This tests how well the colours are identifiable.


COLOUR BLINDNESS

2 April 2021

People usually find out at an early age whether they are colour-blind. However, there are subtle variants of colour-vision deficiency. The two main types are:

  • Green-blindness – the cone cells in the retina that are sensitive to medium wavelengths are absent or have their response shifted to the red (6 % of men, 0.4 % of women);
  • Red-blindness – the cone cells in the retina that are sensitive to long wavelengths are absent or have their response shifted to the green (2.5 % of men).
Effectively, one (and only one) of the three types of colour receptors is missing. In the much rarer monochrome vision, all working colour receptors are the same or missing and only brightness variations are seen. Figure 24 is a test on green-blindness and red-blindness. It works on a computer screen (when looking straight at it), projected with a beamer and sometimes even in unfaded print, although this will depend on the quality of the equipment.
Colour vision test Colour vision test
Figure 24: The readable text in this image is the colour-vision diagnosis of the reader. It is not a puzzle: there is no hidden message that requires much effort to see. The clarity of the text is not important, only whether it is readable at all; in normal vision one text is clearer than the other. This test only works for standard, red-blind and green-blind vision, not monochrome vision. Please do not make life-changing decisions based only on this test.

To simulate green-blindness, all RGB colours in an image are converted to R′G′B′ colours with
R ′ = (4211 + 0.677 G2.2 + 0.2802 R2.2)1/2.2,
G ′ = (4211 + 0.677 G2.2 + 0.2802 R2.2)1/2.2,
B ′ = (4211 + 0.95724 B2.2 + 0.02138 G2.2 − 0.02138 R2.2)1/2.2,
with parameters R, G and B in the range 0–255 and the output values rounded. To simulate red-blindness, colours are shifted as follows:
R ′ = (782.7 + 0.8806 G2.2 + 0.1115 R2.2)1/2.2,
G ′ = (782.7 + 0.8806 G2.2 + 0.1115 R2.2)1/2.2,
B ′ = (782.7 + 0.992052 B2.2 − 0.003974 G2.2 + 0.003974 R2.2)1/2.2.
These conversions should be applied in sRGB colour space, i.e. they work on a standard video display, but not necessarily on paper. The conversion can be performed with the free software suite ImageMagick. The following two commands make green-blind and red-blind versions of original image original.png, respectively:

convert original.png \( +clone -channel RG -fx "(0.02138+0.6770*G^2.2+0.2802*R^2.2)^(1/2.2)" \) +swap -channel B -fx "(0.02138(1+v.G^2.2-v.R^2.2)+0.9572*v.B^2.2)^(1/2.2)" greenblind.png

convert original.png \( +clone -channel RG -fx "(0.003974+0.8806*G^2.2+0.1115*R^2.2)^(1/2.2)" \) +swap -channel B -fx "(0.003974(1-v.G^2.2+v.R^2.2)+0.9921*v.B^2.2)^(1/2.2)" redblind.png
These are Unix-style commands, for Windows replace \( and \) by ( and ). Figure 25 shows the result when they are applied to a triangle of normal colours.
Colour scale in normal vision
Normal vision
Colour scale in green-blind vision
Green-blind vision
Colour scale in red-blind vision
Red-blind vision
Figure 25: Colour scale in normal, green-blind and red-blind vision. These conversions are only approximate and are designed for a computer screen.
Contrary to popular belief, pure red and green can be distinguished. Instead, yellow/green and purple/blue combinations are problematic. However, there are more unexpected pairs of colours that look the same, as used in Fig. 24. Table 1 shows colour-blind vision simulations of the colour schemes given on this site.

Table 1: Colour schemes as given earlier and approximate simulations of green-blind and red-blind vision.
scheme normal vision green-blind vision red-blind vision
bright Bright scheme in normal vision Bright scheme in green-blind vision Bright scheme in red-blind vision
high-contrast High-contrast scheme in normal vision High-contrast scheme in green-blind vision High-contrast scheme in red-blind vision
vibrant Vibrant scheme in normal vision Vibrant scheme in green-blind vision Vibrant scheme in red-blind vision
muted Muted scheme in normal vision Muted scheme in green-blind vision Muted scheme in red-blind vision
medium-contrast Medium-contrast scheme in normal vision Medium-contrast scheme in green-blind vision Medium-contrast scheme in red-blind vision
light Light scheme in normal vision Light scheme in green-blind vision Light scheme in red-blind vision
sunset Sunset scheme in normal vision Sunset scheme in green-blind vision Sunset scheme in red-blind vision
nightfall Nightfall scheme in normal vision Nightfall scheme in green-blind vision Nightfall scheme in red-blind vision
BuRd BuRd scheme in normal vision BuRd scheme in green-blind vision BuRd scheme in red-blind vision
PRGn PRGn scheme in normal vision PRGn scheme in green-blind vision PRGn scheme in red-blind vision
YlOrBr YlOrBr scheme in normal vision YlOrBr scheme in green-blind vision YlOrBr scheme in red-blind vision
iridescent Iridescent scheme in normal vision Iridescent scheme in green-blind vision Iridescent scheme in red-blind vision
incandescent Incandescent scheme in normal vision Incandescent scheme in green-blind vision Incandescent scheme in red-blind vision
rainbow Discrete rainbow scheme in normal vision Discrete rainbow scheme in green-blind vision Discrete rainbow scheme in red-blind vision


GREYSCALE CONVERSION

2 April 2021

According to the Web Content Accessibility Guidelines, a contrast ratio between colours of at least 3 is recommended by ISO-9241-3 for standard text and vision, but the Guidelines define a stronger criterion of at least 4.5 to make the colours useful for people with moderately low vision. This includes people with monochrome vision, who only see brightness variations. The criterion actually only applies to body text, but "charts, graphs, diagrams, and other non-text-based information [...] should also have good contrast to ensure that more users can access the information."

The criterion cannot be met using more than one print-friendly websmart colour plus white and black. The only blue shades are 4477BB and 5577AA, almost the same as the blue from the bright scheme. A websmart shade of grey is not available: only 757575 meets the criterion. The largest minimum contrast ratio in a set of two print-friendly websmart colours plus white and black is 2.8 and in a set with three such colours 2.1. One example with three colours is the high-contrast scheme. However, with some precautions it can still be applied to lines and symbols: use the colours in the order

  •  blue  yellow  red  from the high-contrast scheme
on a white background and use black only for annotation (e.g. text or a grid) that is not on top of blue. When the first two colours are used, the contrast between yellow and white is just 2.1, but that is probably less important than the contrast between blue and yellow, which is large enough: 4.52. Only in the case of all three colours does the contrast between them decrease to 2.1, but that is the highest achievable value. Use different types of lines and symbols for better clarity.

The largest minimum contrast ratio with six colours is 1.5. The medium-contrast scheme uses print-friendly websmart colours not darker than the blue in the high-contrast scheme (from light to dark):

  •  light yellow  light red  light blue  dark yellow  dark red  dark blue  from the medium-contrast scheme
with the contrast ratio decreasing slightly to 1.4 between the lighter colours.

All other schemes fail the contrast-ratio criterion completely, as they contain too many colours and were designed for standard, red-blind and green-blind vision, relying not only on brightness differences, but also on hue differences. If one of the other qualitative schemes is used, the best subsets for greyscale conversion are (from light to dark):

  •  yellow  red  blue  from the bright scheme;
  •  cyan  teal  red  from the vibrant scheme;
  •  cyan  olive  purple  wine  from the muted scheme.
These subsets are slightly clearer than the medium-contrast scheme (but with fewer colours) and less clear than the high-contrast scheme.

The YlOrBr, iridescent and incandescent sequential schemes work well (Fig. 26). The first two are print-friendly. The last two were designed to be useful in grey, with a linearly varying luminance. Python's default sequential scheme viridis has a similar property, but it is not print-friendly and seems to have fewer discernible colours. The rainbow schemes do not work. By definition, all diverging schemes do not work either after greyscale conversion.

YlOrBr
YlOrBr scheme with grey version
Iridescent
Iridescent scheme with grey version
Incandescent
Incandescent scheme with grey version

Figure 26: The YlOrBr, iridescent and incandescent sequential colour schemes, with below the grey shades with the same luminance.


COLOUR SCHEME FOR GROUND COVER

31 May 2018

Some data sets need a very specific colour scheme. An example is the global land cover classification, as generated by the University of Maryland Department of Geography from AVHRR data acquired between 1981 and 1994, available at a resolution of 1 km. There is a recommended colour scheme, but the colours are not distinct, some not even in normal vision. Figure 27 gives a more subtle and logical scheme where all colours are distinct in all visions. Figure 28 shows the world with a reduced resolution of 20 km using this scheme. Figure 29 shows only North America at a resolution of 5 km, using almost all classes.

Map in ground-cover scheme

Colours: '#5566AA', '#117733', '#44AA66', '#55AA22', '#668822', '#99BB55', '#558877', '#88BBAA', '#AADDCC', '#44AA88', '#DDCC66', '#FFDD44', '#FFEE88', '#BB0011'.

Figure 27: Colour-blind safe colour scheme for the AVHRR global land cover classification. The colours have been numbered with the data values.
Global land cover classification
Figure 28: Global land cover classification using the scheme of Fig. 27. The most frequent value of blocks of 20 × 20 original pixels was used.
Global land cover classification in North America
Figure 29: Land cover classification of North America at a resolution of 5 km. All possible classes except deciduous needleleaf forest are found.


GOOD AND BAD COLOUR SCHEMES COMPARED

22 November 2009

The following figures show the true physical figure of the Earth using two colour schemes: the smooth sunset scheme defined here and a traditional rainbow scheme as defined by many programs (e.g. IDL).

Sunset scheme
Good scheme
Traditional scheme
Bad scheme
Most rainbow schemes contain bands of almost constant hue with sharp transitions between them, which are perceived as jumps in the data. In this example large areas are green without features, while for example the yellow line in northern Australia implies a sudden change that does not exist in reality. The oceanic trench at top right can be seen over the whole length with the sunset scheme, while it becomes difficult to see near Japan with the traditional scheme. This shows that it is more important that a scheme is smooth than that it contains many colours. In addition, colour-blind people have difficulty distinguishing some colours of the rainbow. With the traditional scheme, the yellow spot in the middle of the Sahara is not visible in red-blind vision, making the green areas effectively even larger than they are in normal vision. Last but not least, the sunset scheme emphasizes more clearly the average (light colours) and the extremes (dark colours of contrasting hues).

In this context the meaning of the figures is not really important, but if you're interested: they show the distance between the WGS84 ellipsoid and the geoid calculated with the EGM96 gravity model.


MAP MAKING

31 December 2012

Currently I produce maps in two steps. First, I perform the analysis in whatever program and export the data as a particular type of ASCII table. Then, I apply a colour look-up table to the data and export the result as a PNG file. This way, I don't have to redo the analysis if I want a different colour scale, e.g. to emphasize a different value range. The second step is performed on the command line with the command "convert" of ImageMagick, a free, cross-platform and open-source program suite for image manipulation.

The data are exported to a plain portable graymap (PGM) file, which is an ASCII file starting with "P2 w h 65535 ", where w is the width and h the height of the map, followed by a list of integers in the range 0 to (in my case) 65535 with a space or newline between the values. Because the width and height are given, the spaces and newlines can be put wherever you like. The "P2" identifies the file as a PGM file. I scale the data so all values are in the range 0–65532 (but you don't have to fill this whole range). The other possible values are reserved: 65533 for bad data, 65534 for text and lines and 65535 for no data (e.g. outside the projection of the world).

The colour look-up table (clut) is exported to a plain portable pixmap (PPM) file, which is an ASCII file starting with "P3 1 n 255 ", where n is the number of colours, followed by a list of RGB coordinates of the colours as integers in the range 0–255 with a space or newline between the values. I don't use perfectly white, because that may become transparent later on.

Now the image can be produced. The data is stored in input.pgm, the clut in clut.ppm and the image should be output.png. If none of the 3 reserved values are used, then the command is:

convert input.pgm -level 0,65532 clut.ppm -interpolate integer -clut -depth 8 output.png
To spread all available colours over the data range [b,w], change the level option to "-level b,w" (values outside this range will have the first or last colour). To interpolate the colours (for a smooth gradient instead of discrete steps), remove option "-interpolate integer". If any of the reserved values are used, then the command is:
convert input.pgm \( +clone -level 0,65532 clut.ppm -interpolate integer -clut \) \( -clone 0 -black-threshold 65533 -transparent black -fill \#000 -opaque \#FFFEFFFEFFFE -fill \#777 -opaque \#FFFDFFFDFFFD \) -flatten -transparent white -depth 8 output.png
Here I have assumed that text should be black (#000), bad data grey (#777) and areas without data transparent. If you want a white instead of a transparent background, remove option "-transparent white". To treat bad data as background, set it to #FFF. The command above is given in Linux syntax; in Windows, remove all backslashes. If the background is transparent, for clarity a white outline can be added around the objects:
convert output.png -bordercolor none -border 1 \( +clone -channel A -morphology edgeout square +channel +level-colors white \) -compose dstover -composite output_outlined.png

An example: given a map of the albedo at 750 nm including the legend (input.pgm) and a list of colours (clut.ppm), the output of the last two commands above (with "-level 0,9999" and without "-interpolate integer") is this image.

Output map with outline

SRON POWERPOINT TEMPLATE

13 September 2016

The SRON style for presentations has a dark grey background. I have produced a design template for PowerPoint 2003 or earlier and a theme for PowerPoint 2007 or later with a palette including the regular colours white (for titles), light yellow (for normal text) and orange (for stressed text), but also three extra colours that are suitable for use with beamers: the light blue of the footer and shades of green and red that work well.

However, I also made an alternative version of the theme with a white background on all pages except the title page, either standard (4:3) or wide (16:9).


SRON LATEX TEMPLATE

2 April 2016

The current official style of SRON reports, technotes, etc. can also be achieved in LaTeX and pdfLaTeX. Two files are needed:

Running (pdf)LaTeX on srontemplate.tex should give a result that looks like this. Under Debian, you may need to execute first (once) the command "sudo apt-get install texlive-fonts-extra".


Paul Tol

I am a Dutch instrument scientist with a PhD in atomic physics, working on the TROPOMI, SPEXone and TANGO projects in the Earth programme of SRON. I have normal colour vision, but many colleagues have not. My email address: p.j.j.tol@sron.nl.