Package 'afcolours'

Title: Government Analysis Function Recommended Accessible Colour Palette
Description: Government Analysis Function recommended colours for use in charts on gov.uk to help meet accessibility guidance.
Authors: Luke Davies [aut, cre], Charlotte Rowley [aut], The Office for National Statistics [cph]
Maintainer: Luke Davies <[email protected]>
License: MIT + file LICENSE
Version: 1.0.0
Built: 2025-02-28 02:45:32 UTC
Source: https://github.com/cran/afcolours

Help Index


Analysis Function colour palette function

Description

Generate a colour palette based on the selected chart and colour_format type (hex/rgb).

Usage

af_colours(
  type = c("categorical", "duo", "sequential", "focus"),
  colour_format = "hex",
  n = 6
)

Arguments

type

Name of required palette. Choices are: categorical, duo, sequential, focus

colour_format

Type of colour code to return. Choices are: hex, rgb If omitted, returns hex code

n

Number of colours to return for categorical palette type (max 6). If omitted, uses all colours.

Value

A vector of colour codes

Examples

data <- data.frame(x = c(1,2),
                   y = c(1,2),
                   z = c("a","b")
        )
ggplot2::ggplot(data, ggplot2::aes(x = x, y = y, colour = z)) +
ggplot2::geom_point() +
ggplot2::scale_colour_manual(values = af_colours("duo"))