Use GOV.UK colours
Methods to access and use the GOV.UK design system colour palette from within the {govukhugo}
package. The GOV.UK design system includes a colour palette, these can be accessed via the govuk_colours
vector, it includes both Sass variable colour names (e.g. govuk-text-colour) as well as the named colour palette. The GOV.UK colour scheme was not designed with data visualisation in mind. The govuk_palette()
function provides an opinionated selection of GOV.UK colours for use in charts (e.g. via ggplot2::scale_fill_manual()
).
You should always think carefully about the colours you use in data visualisation and ensure your visualisation does not rely solely on colour to convey meaning. Depending on the nature of your visualisation it may be appropriate to use other colour scales, such as the Color Brewer scales by Cynthia Brewer (available in R through the {RColorBrewer}
package).
|
|
Arguments
- pal
-
One of
categorical
(the default),blue
,blrd
,bldrd_dark
,blyl
,putq
, or a colour name fromgovuk_colours
govuk_colours
The govuk_colours
vector provides all of the colours listed in the Design System colour palettes documentation colour palette, this includes both the palette colours and the Sass named variables (e.g. govuk-text-colour
).
Palette colours
red
(#d4351c)yellow
(#ffdd00)green
(#00703c)blue
(#1d70b8)dark-blue
(#003078)light-blue
(#5694ca)purple
(#4c2c92)black
(#0b0c0c)dark-grey
(#505a5f)mid-grey
(#b1b4b6)light-grey
(#f3f2f1)white
(#ffffff)light-purple
(#6f72af)bright-purple
(#912b88)pink
(#d53880)light-pink
(#f499be)orange
(#f47738)brown
(#b58840)light-green
(#85994b)turquoise
(#28a197)chart-white
(#f9f8f8)
The chart-white
colour is not a GOV.UK official palette colour but included in the palette to enable effective visualisation in charts, see govuk_palette()
documentation below.
Sass variables
govuk-text-colour
(#0b0c0c)govuk-secondary-text-colour
(#505a5f)govuk-link-colour
(#1d70b8)govuk-link-hover-colour
(#003078)govuk-link-visited-colour
(#4c2c92)govuk-link-active-colour
(#0b0c0c)govuk-border-colour
(#b1b4b6)govuk-input-border-colour
(#0b0c0c)govuk-focus-colour
(#ffdd00)govuk-focus-text-colour
(#0b0c0c)govuk-error-colour
(#d4351c)govuk-success-colour
(#00703c)govuk-brand-colour
(#1d70b8)
govuk_palette
The govuk_palette()
function provides an opinionated selection of GOV.UK colours for use in charts (e.g. via ggplot2::scale_fill_manual()
). It has a single argument, pal
, which must be one of categorical
, blues
, blrd
, blrd_dark
, blyl
, putq
or one of the names from the govuk_colours
vector.
Categorical palette
The categorical
palette provides a set of colours for displaying discrete categories where a distinction between the categories is valuable. It provides 6 colours:
blue
(#1d70b8)orange
(#f47738)turquoise
(#28a197)bright-purple
(#912b88)yellow
(#ffdd00)dark-blue
(#003078)
Sequential palettes
The blues
palette provides the three GOV.UK blues in sequential order from dark to light:
dark-blue
(#003078)blue
(#1d70b8)light-blue
(#5694ca)
If you wish to use another GOV.UK for a sequential palette, supplying a name from govuk_colours
as the pal
argument will return two colours for use as end-points in a sequential palette, the original colour and a version of the colour that is roughly a third lighter. For example:
govuk_palette("yellow")
returns (#ffdd00) and (#ffeeb7)govuk_palette("green")
returns (#00703c) and (#aecab5)
Divergent palettes
There are four palettes for use in divergent colour scales, using chart-white
as their mid-point:
blrd
which uses GOV.UK blue and red as its end-points:blrd_dark
which uses GOV.UK dark blue as its blue end-point and a darker red of the same hue as GOV.UK red as its red end-point:blyl
which uses GOV.UK blue and yellow as its end-points:putq
which uses GOV.UK purple and turquoise as its end-points: