Skip to contents

Adds a ggplot2::theme that applies WCAG 2.1 contrast settings plus the package's recommended font sizes. Compose with + like any other theme. The font sizes are package defaults, not WCAG-mandated minimums – WCAG specifies resizability and large-text thresholds, not absolute pt.

Usage

theme_a11y(level = "AA", base_family = "", dark = FALSE)

Arguments

level

WCAG contrast level: "AA" (default) or "AAA". The level controls contrast targets and the package's default font sizes; only the contrast targets are WCAG-defined.

base_family

Font family. Defaults to system sans.

dark

Logical; if TRUE, use a dark-mode palette appropriate for darkly-style themes.

Value

A theme object.

Examples

if (requireNamespace("ggplot2", quietly = TRUE)) {
  library(ggplot2)
  ggplot(mtcars, aes(mpg, wt)) + geom_point() + theme_a11y()
}