From 51b2f7e8f708546d24c9db860368b8bf50904cc9 Mon Sep 17 00:00:00 2001 From: Ernest Guevarra Date: Sun, 3 Mar 2024 13:01:05 +0000 Subject: [PATCH] add preliminary single colour sequential colours --- NAMESPACE | 1 - R/motif.R | 2 +- R/theme_acdc.R | 12 ++++++++-- man/acdc_palette.Rd | 2 +- vignettes/africa-cdc.Rmd | 52 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 5 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 7b01526..44be191 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -26,7 +26,6 @@ importFrom(ggplot2,margin) importFrom(ggplot2,theme) importFrom(ggplot2,theme_minimal) importFrom(grDevices,col2rgb) -importFrom(grDevices,colorRampPalette) importFrom(grDevices,rgb) importFrom(graphics,image) importFrom(graphics,par) diff --git a/R/motif.R b/R/motif.R index 92baff7..1b2bfa3 100644 --- a/R/motif.R +++ b/R/motif.R @@ -15,7 +15,7 @@ #' @importFrom ggplot2 theme element_rect element_line element_text margin #' theme_minimal element_blank #' @importFrom grid unit -#' @importFrom grDevices col2rgb rgb colorRampPalette +#' @importFrom grDevices col2rgb rgb #' @importFrom graphics rect par image text #' "_PACKAGE" diff --git a/R/theme_acdc.R b/R/theme_acdc.R index 87a038f..e0fb294 100644 --- a/R/theme_acdc.R +++ b/R/theme_acdc.R @@ -50,8 +50,16 @@ acdc_dark_green <- "#4B5430" #' @export #' acdc_palettes <- list( - acdc_primary = c("#348F41", "#B4A269", "#000000"), - acdc_secondary = c("#6B4C24", "#E08F2A", "#C45B39", "#782C2D", "#4B5430") + acdc_primary = c("#348F41", "#B4A269", "#000000"), + acdc_secondary = c("#6B4C24", "#E08F2A", "#C45B39", "#782C2D", "#4B5430"), + acdc_greens = c("#348F41", "#5CA567", "#85BB8D", "#ADD2B3", "#D6E8D9"), + acdc_golds = c("#B4A269", "#C3B487", "#D2C7A5", "#E1D9C3", "#F0ECE1"), + acdc_blacks = c("#000000", "#333333", "#666666", "#999999", "#CCCCCC"), + acdc_browns = c("#6B4C24", "#886F4F", "#A6937B", "#C3B7A7", "#E1DBD3"), + acdc_yellows = c("#E08F2A", "#E6A554", "#ECBB7F", "#F2D2A9", "#F8E8D4"), + acdc_oranges = c("#C45B39", "#CF7B60", "#DB9C88", "#E7BDAF", "#F3DED7"), + acdc_reds = c("#782C2D", "#935657", "#AE8081", "#C9AAAB", "#E4D4D5"), + acdc_dark_greens = c("#4B5430", "#6F7659", "#939882", "#B7BAAC", "#DBDCD5" ) ) diff --git a/man/acdc_palette.Rd b/man/acdc_palette.Rd index 1cc2d04..7e90f01 100644 --- a/man/acdc_palette.Rd +++ b/man/acdc_palette.Rd @@ -5,7 +5,7 @@ \alias{acdc_palettes} \title{Africa CDC palettes} \format{ -An object of class \code{list} of length 2. +An object of class \code{list} of length 10. } \usage{ acdc_palettes diff --git a/vignettes/africa-cdc.Rmd b/vignettes/africa-cdc.Rmd index d496388..4d91882 100644 --- a/vignettes/africa-cdc.Rmd +++ b/vignettes/africa-cdc.Rmd @@ -56,6 +56,58 @@ These are complemented by a set of five secondary colours. structure(acdc_palettes$acdc_secondary, class = "palette", name = "Africa CDC Secondary Colours") ``` +## Africa CDC Palettes + +In addition to the primary and secondary colours, a set of tinted palettes for each Africa CDC colour is available. + +### Tinted green palette + +```{r acdc-green-tint, echo = FALSE, fig.align = "center", fig.height = 1} +structure(acdc_palettes$acdc_greens, class = "palette", name = "Africa CDC Greens") +``` + +### Tinted gold palette + +```{r acdc-gold-tint, echo = FALSE, fig.align = "center", fig.height = 1} +structure(acdc_palettes$acdc_golds, class = "palette", name = "Africa CDC Golds") +``` + +### Tinted black palette + +```{r acdc-black-tint, echo = FALSE, fig.align = "center", fig.height = 1} +structure(acdc_palettes$acdc_blacks, class = "palette", name = "Africa CDC Blacks") +``` + +### Tinted brown palette + +```{r acdc-brown-tint, echo = FALSE, fig.align = "center", fig.height = 1} +structure(acdc_palettes$acdc_browns, class = "palette", name = "Africa CDC Browns") +``` + +### Tinted yellow palette + +```{r acdc-yellow-tint, echo = FALSE, fig.align = "center", fig.height = 1} +structure(acdc_palettes$acdc_yellows, class = "palette", name = "Africa CDC Yellows") +``` + +### Tinted orange palette + +```{r acdc-orange-tint, echo = FALSE, fig.align = "center", fig.height = 1} +structure(acdc_palettes$acdc_oranges, class = "palette", name = "Africa CDC Oranges") +``` + +### Tinted red palette + +```{r acdc-red-tint, echo = FALSE, fig.align = "center", fig.height = 1} +structure(acdc_palettes$acdc_reds, class = "palette", name = "Africa CDC Reds") +``` + +### Tinted dark green palette + +```{r acdc-dark-green-tint, echo = FALSE, fig.align = "center", fig.height = 1} +structure(acdc_palettes$acdc_dark_greens, class = "palette", name = "Africa CDC Dark Greens") +``` + ## Africa CDC `ggplot2` theme ### Africa CDC light theme